473,394 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 4257
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: steve | last post by:
Hi, I am opening a stream that is UTF encoded. I use fgetc to read the stream- which is binary safe. I add every character read to a string. But when I look at the stream, I see some...
1
by: Oliver Kurz | last post by:
Hello, I have a problem by converting a string to base64 and back again. I have a string with german special chars like äöüß. This string i convert with base64str=base64.encode('äöüß') into...
7
by: Jonas Galvez | last post by:
Hi, I need a function to parse badly encoded 'Subject' headers from e-mails, such as the following: =?ISO-8859-1?Q?Murilo_Corr=EAa?= =?ISO-8859-1?Q?Marcos_Mendon=E7a?= I tried using the...
18
by: LarsM | last post by:
Hi all, I am new to XML, but I use it for an RSS feed. I have one problem, which I have really been struggling with. My XML document is generated from the contents of a MySQL database. It is...
9
by: Mark | last post by:
I've run a few simple tests looking at how query string encoding/decoding gets handled in asp.net, and it seems like the situation is even messier than it was in asp... Can't say I think much of the...
3
by: Ron Clabo | last post by:
I have a URL Decoding issue. The text that needs to be decoded is: "123+H%F6gbergsgatan+st" The decoded version should equate to: "123 Högbergsgatan st"
8
by: Herman.Schultz | last post by:
Hi, Can you please tell me if there is a library function in C++/C to do URL decoding? i.e. change from: http%3A%2F%2F to: http:// Thank you.
2
by: pmz | last post by:
Dear Group, I've got a problem with decoding e-mail message subject, which has been read within usage of Pear_Mail_Mime library. There are some elements unwelcome in my subject string, such...
0
by: Michele | last post by:
Hi there, I'm using a python script in conjunction with a JPype, to run java classes. So, here's the code: from jpype import * import os import random import math import sys
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.