473,396 Members | 1,722 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,396 software developers and data experts.

Culture and Codepage question

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
Nov 17 '05 #1
2 1784
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.Te xtInfo.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 A. Valasek, Altair Communications, http://www.altaircom.net
Please do not reply to this e-mail, for contact see http://www.rider.cz
Keeping Freedom safe from Democracy
Nov 17 '05 #2
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

"Michal A. Valasek" <ne**@altaircom.net> wrote in message
news:eC**************@tk2msftngp13.phx.gbl...
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.Te xtInfo.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 A. Valasek, Altair Communications, http://www.altaircom.net
Please do not reply to this e-mail, for contact see http://www.rider.cz
Keeping Freedom safe from Democracy

Nov 17 '05 #3

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

Similar topics

10
by: Christopher H. Laco | last post by:
Long story longer. I need to get web user input into a backend system that a) only grocks single byte encoding, b) expectes the data transer to be 1 bytes = 1 character, and c) uses the HP Roman-6...
0
by: Jörg Schulz | last post by:
I am missing this codepage quiet some time, but I was able to patch another unneeded mapping to my needs. Unfortunately I wasn't able to add a complete new mapping. Maybe someone of you can do...
8
by: Kim Bundgaard | last post by:
Hi Anyone know where I can look for problem with codepage conversion between DB2 UDB Connect EE V8.2 (fixpak 3) and DB2 UDB z/OS V7. With DB2 UDB Connect EE V7.2 (fixpak 7) i get Ebcdic X'5A'...
4
by: Ram | last post by:
Dear All, Good Day I am trying to convert a file which is generated on AS400 with codepage 00420 (arabic & English data combination) with no success. But using the same code( and changing 20420...
0
by: asklucas | last post by:
Hi there, I got an MS Access DB, which is causing problems when the client PC is running using a Traditional Chinese codepage. The DB was probably created with Access 97, Western European...
3
by: shapper | last post by:
Hello, I am working on a multilanguage Asp.Net 2.0 web site. I need to do the following: 1. Set a default culture in Web.Config File. 2. Create a function which changes culture when pressed....
4
by: adiel_g | last post by:
I am trying to display some data that I received into a form. The form is in english. The data is in cyrillic (russian) which uses codepage 1251. I am trying to change the button text to...
0
by: Cuaracao | last post by:
This is my code: Code1: 'DoCmd.OpenTable "tblImport" 'DoCmd.TransferDatabase acExport, "dBASE IV", strOutputDir,acTable,"sel_TblImport", strDbfName & ".dbf", False ' DoCmd.Close acTable,...
0
by: SiliconJaltz | last post by:
Hi, I'm trying to convert some RTF text to Unicode UTF-16. The characters I'm converting are double byte Japanese. The character set is fcharset128 which should be codepage 932. I am looking...
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: 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
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...
0
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,...
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...
0
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...

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.