Culture and Codepage question

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
 
M

Michal A. Valasek

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.
 
M

Mike Prager

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top