Chinor
Chinor

Reputation: 101

Is there any way to convert IBM937 to Unicode in .NET

Is there any way to convert IBM937(EBCDIC with Chinese zh-tw) to Unicode in .NET?
The Encodings in .NET supported some EBCDIC encodings, but not all, especially in DBCS.

I want to convert EBCDIC byte array (maybe with 0x0e, 0x0f) from/to Unicode string in .NET.

After surveying this question,
I found there is a question like this, but the answer is using Java:
How to convert EBCDIC with Chinese chars to UTF-8 format

Another answer is using ICU4C(for C/C++) of ICU (International Components for Unicode).
Is this a right usage to create a Converter in ICU4C as below? (I'm not sure)

conv = ucnv_open("IBM-937", $fromBytes)
// then use ucnv_fromUChars or ucnv_toUChars to convert string.

If this is right,
the NuGet Packages icu.net and Icu.Win (the .NET wrapper for the ICU4C) may be helpful.
But I can't find more samples or documents for using this wrapper to do things like ICU4C.

Any suggestion or comment will be appreciated.

Upvotes: 1

Views: 332

Answers (0)

Related Questions