Culture and Codepage question

  • Thread starter Thread starter Mike Prager
  • Start date Start date
M

Mike Prager

Hi,

I have written a Hotmail type application where users choose their language
preference which is used to set the culture and hence the correct resource
files for strings, formatting etc. I now need to create a mime message but I
have to pass in the correct encoding so the charset is correctly selected. I
cannot find any progrmmatic correlation between the two? Is there any way to
derive from a users culture the correct language and hence codepage and
encoding. The Encoding class has a GteEncoding method where ou can pass in a
codepage or a string representation e.g Windows-1252.


Any help would be gratefully appreciated

Thanks

Mike
 
Hello,

| I have written a Hotmail type application where users choose their
language
| preference which is used to set the culture and hence the correct resource
| files for strings, formatting etc. I now need to create a mime message but
I
| have to pass in the correct encoding so the charset is correctly selected.
I
| cannot find any progrmmatic correlation between the two? Is there any way
to
| derive from a users culture the correct language and hence codepage and
| encoding. The Encoding class has a GteEncoding method where ou can pass in
a
| codepage or a string representation e.g Windows-1252.

I hink that you may try to get ANSI codepage number via
System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage, then
get the appropriate encoding (via Encoding.GetEncoding method) and then ask
for its HeaderName property.

But better way may be to use utf-7 for all messages and everything is
solved, regardless the language.
 
Michal,

Brilliant! Thanks so much for this.I've been banging my head against a brick
wall trying to suss this out. In case you are interested, the problem is
that to generate a mime compliant file, for non ansii character sets, I need
to encode the characters, BAse64 it and then declare it in the charset
property of the message or header. It would be so much simpler to use
Unicode but thats life for you!!!

Thanks again

Mike
 
Back
Top