Home All Groups Group Topic Archive Search About

Encoding to ISO-8859-1 problems

Author
1 Feb 2007 3:16 PM
ThunderMusic
Hi,
We are trying to encode to ISO-8859-1, but we have problems doing it using
the encoders in .NET. We get some unknown characters in some culture which
comes out fine if we post (from IE) from a page in ISO-8859-1 to another
page using ISO-8859-1, but cannot take a .NET string or a UTF-8 string,
convert it in ISO-8859-1 and display it with this encoding using the same
content in the string...

Are there anyone that know how IE does it? Is there any correspondance
table, are the any information into the unicode encoding that says "this
character has this style and should convert to another character with this
style" or something like it?

Thanks

ThunderMusic

Author
1 Feb 2007 3:25 PM
Jon Skeet [C# MVP]
ThunderMusic <NoSpAmdanlatathotmaildotcom@NoSpAm.com> wrote:
> We are trying to encode to ISO-8859-1, but we have problems doing it using
> the encoders in .NET. We get some unknown characters in some culture which
> comes out fine if we post (from IE) from a page in ISO-8859-1 to another
> page using ISO-8859-1, but cannot take a .NET string or a UTF-8 string,
> convert it in ISO-8859-1 and display it with this encoding using the same
> content in the string...
>
> Are there anyone that know how IE does it? Is there any correspondance
> table, are the any information into the unicode encoding that says "this
> character has this style and should convert to another character with this
> style" or something like it?

It's not very clear exactly what's going on. It's quite possible that
when you post in IE, it's not using 8859-1 for the post even if the
pages returned *are* genuinely using 8859-1. It's hard to see how it
would be displayed in that case though.

If a character isn't in 8859-1, you won't be able to represent it in
8859-1.

Do you *have* to use 8859-1 rather than an encoding which can represent
the whole of Unicode (eg UTF-8)?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Author
1 Feb 2007 3:40 PM
ThunderMusic
it's actually because we are sending mails to hotmail, and because our
application is in utf-8 and hotmail uses ISO-8859-1, so if we send a message
encoded using UTF-8, the displayed message comes out plain ugly in
hotmail...

So we must find a way to convert things correctly... to give an exemple of
what should be converted...  a character like the oe (o and e tied together)
should be converted to ISO-8859-1 oe (o and e separatly) because the "tied
together" version does not exists in 8859-1...

Anyone knows how to do it seemlessly?

Thanks

ThunderMusic

Show quote
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MPG.202c16ae6a15fb8e98d80d@msnews.microsoft.com...
> ThunderMusic <NoSpAmdanlatathotmaildotcom@NoSpAm.com> wrote:
>> We are trying to encode to ISO-8859-1, but we have problems doing it
>> using
>> the encoders in .NET. We get some unknown characters in some culture
>> which
>> comes out fine if we post (from IE) from a page in ISO-8859-1 to another
>> page using ISO-8859-1, but cannot take a .NET string or a UTF-8 string,
>> convert it in ISO-8859-1 and display it with this encoding using the same
>> content in the string...
>>
>> Are there anyone that know how IE does it? Is there any correspondance
>> table, are the any information into the unicode encoding that says "this
>> character has this style and should convert to another character with
>> this
>> style" or something like it?
>
> It's not very clear exactly what's going on. It's quite possible that
> when you post in IE, it's not using 8859-1 for the post even if the
> pages returned *are* genuinely using 8859-1. It's hard to see how it
> would be displayed in that case though.
>
> If a character isn't in 8859-1, you won't be able to represent it in
> 8859-1.
>
> Do you *have* to use 8859-1 rather than an encoding which can represent
> the whole of Unicode (eg UTF-8)?
>
> --
> Jon Skeet - <sk***@pobox.com>
> http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
> If replying to the group, please do not mail me too
Author
1 Feb 2007 3:52 PM
Jon Skeet [C# MVP]
ThunderMusic <NoSpAmdanlatathotmaildotcom@NoSpAm.com> wrote:
> it's actually because we are sending mails to hotmail, and because our
> application is in utf-8 and hotmail uses ISO-8859-1, so if we send a message
> encoded using UTF-8, the displayed message comes out plain ugly in
> hotmail...

Does Hotmail *really* only use ISO-8859-1? Eek - how horrible.

> So we must find a way to convert things correctly... to give an exemple of
> what should be converted...  a character like the oe (o and e tied together)
> should be converted to ISO-8859-1 oe (o and e separatly) because the "tied
> together" version does not exists in 8859-1...
>
> Anyone knows how to do it seemlessly?

Right. At that point you're talking about much more than just normal
encoding - and unfortunately we've reached the limit of my knowledge
there :(

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Author
1 Feb 2007 4:45 PM
ThunderMusic
actually, hotmail supports 4 types of encoding, but not UTF-8 nor UTF-16, so
it's becoming a problem...

Thanks...  I'm still searching for informations on the net...

ThunderMusic

Show quote
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MPG.202c1d0f7e209f9898d80e@msnews.microsoft.com...
> ThunderMusic <NoSpAmdanlatathotmaildotcom@NoSpAm.com> wrote:
>> it's actually because we are sending mails to hotmail, and because our
>> application is in utf-8 and hotmail uses ISO-8859-1, so if we send a
>> message
>> encoded using UTF-8, the displayed message comes out plain ugly in
>> hotmail...
>
> Does Hotmail *really* only use ISO-8859-1? Eek - how horrible.
>
>> So we must find a way to convert things correctly... to give an exemple
>> of
>> what should be converted...  a character like the oe (o and e tied
>> together)
>> should be converted to ISO-8859-1 oe (o and e separatly) because the
>> "tied
>> together" version does not exists in 8859-1...
>>
>> Anyone knows how to do it seemlessly?
>
> Right. At that point you're talking about much more than just normal
> encoding - and unfortunately we've reached the limit of my knowledge
> there :(
>
> --
> Jon Skeet - <sk***@pobox.com>
> http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
> If replying to the group, please do not mail me too
Author
2 Feb 2007 3:55 PM
Anthony Jones
Show quote
"ThunderMusic" <NoSpAmdanlatathotmaildotcom@NoSpAm.com> wrote in message
news:u3TBqchRHHA.3316@TK2MSFTNGP02.phx.gbl...
> it's actually because we are sending mails to hotmail, and because our
> application is in utf-8 and hotmail uses ISO-8859-1, so if we send a
message
> encoded using UTF-8, the displayed message comes out plain ugly in
> hotmail...
>
> So we must find a way to convert things correctly... to give an exemple of
> what should be converted...  a character like the oe (o and e tied
together)
> should be converted to ISO-8859-1 oe (o and e separatly) because the "tied
> together" version does not exists in 8859-1...
>
> Anyone knows how to do it seemlessly?
>

The discrepancy you are seeing in the way IE behaves is due to windows
drawing a correlation between the OEM codepage 1252 and the ISO-8859-1.
Windows-1252 is character set based on ISO-8859-1 in that all characters
have the same encoding except for characters in the 128-159 range.  In this
range ISO-8859-1 has a set of control codes that are almost never used these
days.  Windows-1252 borrows this area to squeeze in some extra characters.

When a page coming from source claiming ISO-8859-1 charset uses characters
in this range IE just renders the Windows-1252 characters for them.  However
something sticking more strictly to ISO-8859-1 just doesn't know what to do
with them.

This doesn't solve your problem I know.  If what you say is true then
hotmail is unable to communicate well with all it's possible clients.
That's so shocking it leaves me wondering whether there is something else
wrong.

Can you show some code you are using to generate the email?
Author
2 Feb 2007 6:29 PM
Mihai N.
> If what you say is true then
> hotmail is unable to communicate well with all it's possible clients.
> That's so shocking it leaves me wondering whether there is something else
> wrong.
I strongly-strongly doubt that hotmail is unable to handle UTF-8

> Can you show some code you are using to generate the email?
Agree, most likely the probem is here :-)


From experience I know that the chances that I discov a bug in a compiler are
slim (happened two times only). So before blaming something on the compiler,
I check my code 30 times!

This is one of those. I am so sure that hotmail can handle utf-8, that I
would check my code 30 times :-)


--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

AddThis Social Bookmark Button