Convert Unicode string to EBCDIC

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Could someone pls tell me how to convert a Unicode string to EBCDIC
Intenational.
Is WideCharToMultiByte API is the only way? how do we use it.
Can the Encoding class method GetEncoding(CodePage) be used to achieve the
same result.

Thanks,

- Srinivas
 
Srinivas said:
Hi,

Could someone pls tell me how to convert a Unicode string to EBCDIC
Intenational.
Is WideCharToMultiByte API is the only way? how do we use it.
Can the Encoding class method GetEncoding(CodePage) be used to
achieve the same result.

System.Text.Encoding should do the trick:

// Let's try state-of-the-art EBCDIC 1047 ;-)
Encoding enc = Encoding.GetEncoding(20924);
byte[] bytes = enc.GetBytes("500 €");

All available Win32 code pages and their identifiers are listed here:
http://tinyurl.com/cjwm

Cheers,
 
Back
Top