Convert UTF-8 to Chinese Simplified (GB2312)

11,966

The first thing to be aware of is that there's no such thing as a "UTF-8 string" in .NET. All strings in .NET are effectively UTF-16. However, .NET provides the Encoding class to allow you to decode binary data into strings, and re-encode it later.

Encoding.Convert can convert a byte array representing text encoded with one encoding into a byte array with the same text encoded with a different encoding. Is that what you want?

Alternatively, if you already have a string, you can use:

byte[] bytes = Encoding.GetEncoding("gb2312").GetBytes(text);

If you can provide more information, that would be helpful.

Share:
11,966
Jyothish
Author by

Jyothish

Updated on June 05, 2022

Comments

  • Jyothish
    Jyothish almost 2 years

    Is there a way to convert UTF-8 string to Chinese Simplified (GB2312) in C#. Any help is greatly appreciated.

    Regards Jyothish George