473,572 Members | 3,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Dec oder 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 4286
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.Dec oder 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.Enc oding 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.GetEnc oding(28591);

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

// Decode byte sequence
byte[] bytes = ReadLatin1Encod edContent();
string text = latin1.GetStrin g(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********@joer gjooss.de
Feb 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3960
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 characters with a bunch of "?" question markets, and then utf8_decode has no effect on it either. How do you go about decoding utf. Does adding the...
1
8073
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 a base64 representation. Backwards I got an error:
7
2660
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 decode() method from mimetools but that doesn't appear to be correct solution. I ended up coding the following: import re
18
17475
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 UTF-8 encoded. However, the Danish special characters appear wrong.
9
23692
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 "improvements", but maybe someone here can point me in the right direction... First, it looks like asp.net will automatically read and recognize...
3
2274
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
6851
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
7912
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 as: =?ISO-8859-2?Q?My subject. Especially when subject contains polish characters, i.e.:
0
1807
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
7733
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7640
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7957
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8155
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7705
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5248
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2138
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1240
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
975
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.