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

Steven Schveighoffer schveiguy at gmail.com
Tue Mar 7 02:11:41 UTC 2023


On 3/6/23 8:45 PM, John Xu wrote:
> I'm new to dlang. I didn't find much tutorials on internet about how to 
> read/write Chinese easily. std.encoding doesn't seem to support GBK or 
> GB18030:
> 
> "Encodings currently supported are UTF-8, UTF-16, UTF-32, ASCII, 
> ISO-8859-1 (also known as LATIN-1), ISO-8859-2 (LATIN-2), WINDOWS-1250, 
> WINDOWS-1251 and WINDOWS-1252."

It appears that encoding is not supported.

There is a scant mention of it, in the BOM detection. But I don't think 
there's any mechanism to encode/decode it.

> 
> Then what is best way to read GBK/GB18030 contents ? Even GBK/GB18030 
> file names ?
> 
> 

D has direct bindings to C, so possibly using a C library. I don't see 
anything jumping out at me from code.dlang.org

-Steve


More information about the Digitalmars-d-learn mailing list