471,348 Members | 1,293 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

decoding ISO 8859

Hi all,
I'm trying to decode a byte array containing char conforming to ISO
8859 standard, it is a german text actually. I tried using the old win32
MultiByteToWide API, using CP_ACP as the code page with the locale set
to german. It works most of the time, but certain strings will display
funny char. It is perhaps due to the API's limitation in conversion. I
looked through the System.Text.Decoder class but it seems there is no
way for me to specify ISO-8859 format as the decoder. Can someone
enlighten me on this?
Feb 21 '06 #1
1 3873
Thus wrote Lonewolf,
Hi all,
I'm trying to decode a byte array containing char conforming to ISO
8859 standard, it is a german text actually. I tried using the old
win32
MultiByteToWide API, using CP_ACP as the code page with the locale set
to german. It works most of the time, but certain strings will display
funny char.
It is perhaps due to the API's limitation in conversion. I
looked through the System.Text.Decoder class but it seems there is no
way for me to specify ISO-8859 format as the decoder. Can someone
enlighten me on this?


System.Text.Encoding is the BCL class to encode and decode character strings
(Encoder and Decoder are collaborating objects).

There are quite a few encodings in the ISO-8859-x family. I'm assuming you're
referring to ISO-8859-1.

// Create an Encoding by Win32 code page identifier
Encoding latin1 = Encoding.GetEncoding(28591);

// Create an Encoding by IANA name
Encoding latin1 = Encoding.GetEncoding("iso-8859-1");

// Decode byte sequence
byte[] bytes = ReadLatin1EncodedContent();
string text = latin1.GetString(bytes);

A list of all Win32 code page identifiers can be found in the Platform SDK:
http://msdn.microsoft.com/library/de...icode_81rn.asp

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Feb 21 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by steve | last post: by
1 post views Thread by Oliver Kurz | last post: by
7 posts views Thread by Jonas Galvez | last post: by
9 posts views Thread by Mark | last post: by
3 posts views Thread by Ron Clabo | last post: by
8 posts views Thread by Herman.Schultz | last post: by
2 posts views Thread by pmz | last post: by
reply views Thread by Michele | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.