473,654 Members | 3,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1793
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.Globaliz ation.CultureIn fo.CurrentCultu re.TextInfo.ANS ICodePage, then
get the appropriate encoding (via Encoding.GetEnc oding 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******** ******@tk2msftn gp13.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.Globaliz ation.CultureIn fo.CurrentCultu re.TextInfo.ANS ICodePage, then get the appropriate encoding (via Encoding.GetEnc oding 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
687
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 codepage system wide. As much as it sounds good, UTF/Unicode encoding is not an option, nor is changing the codepage. Tackling the first is easy via Encoding.Default.GetBytes and shoving it over the network. However, Encoding.Default is the...
0
1296
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 this better... :-) I added some tiny scripts that generate at least the needed mappings in the src/backend/utils/mb/Unicode/*.map files. Hope this helps to get PostgreSQL support more codepages.
8
8380
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' converted to Ascii X'A4', but with V8 I get it converted to Ascii X'80'. I use Ebcdic codepage/ccsid 277 and client codepage 1252. It looks like a problem with Windows Latin-1 1252/5348 - the Euro codepage,
4
7120
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 to 708) I am able to convert a file from codepage ASMO 708 to windows based file and it is perfect. The following is the code I tried. i used 20420 codepage which is the nearest match for 00420. but no luck. //Open file for reading and set...
0
1821
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 codepage. However, the DB I got is now already in Access 2002 / 2003 file format, thus should be already converted to Unicode. When I open the DB on my PC with Western European codepage, it runs
3
3376
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. Remember the choosen culture next time the visitor comes to the web site. 3. Retrieve the current culture.
4
2585
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 russian. For example: cmdCancel.Text = "Îòìåíèòü" Those are garbage characters which I dont mind if they are in that format in the code. But when the actual button is displayed on the screen, I want the real cyrillic (russian) characters to be
0
3307
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, "tblImport" ======================================================== Code2:
0
1450
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 for a way to ask .NET given a character set for it to return the correct codepage or encoding. How do I map the character set 128 to the correct codepage?
0
8294
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8709
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8494
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
7309
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5627
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1597
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.