Best way to read/write Chinese (GBK/GB18030) files?

John Xu 728308756 at qq.com
Fri Mar 10 02:48:43 UTC 2023


> I found this: 
> https://github.com/meatatt/exCode/blob/master/source/excode/package.d
>
> There is mention of unicode/GBK conversion, maybe it could be 
> helpful

Thanks for quick answers. Now I found I can read both UTF8 and 
UTF-16LE
chinese file:
     string txt = std.file.read(chineseFile).to!string;

and write to UTF8 file:
     std.file.write(utf8ChineseFile, txt);

But still need figure out how to read/write GBK directly.



More information about the Digitalmars-d-learn mailing list