Charset Encoding

usvpn

Freshman
Joined
Apr 19, 2010
Messages
45
Good morning,
I need to pass the Charset Encoding name which is defined in the 2nd column of the below table:

http://msdn.microsoft.com/en-us/library/system.text.encoding(v=vs.80).aspx

Like windows-1256 or utf-8...

However, I know that not all of them are applicable for my Windows application which only runs on Intel x86 or x64 platforms and only WinXp, Vista, 7 OS.
So which ones are applicable for me?
For example, some MAC encoding, like x-mac-japanese or x-mac-arabic are for MAC only? Or can be used in Windows too?
Or also for UTF-32, it always returns System.NotSupportedException
 
It would be easier to give helpful advice if you explain what you are doing a little better.

Are you trying to encode text? Or read text with various encodings? Where is the text coming from or going to?
 
I am using an email component, it needs me to set the EmailMessage.CharSet property according to the supported values from this table:

http://msdn.microsoft.com/en-us/library/system.text.encoding(v=vs.80).aspx

Like windows-1256 or utf-8...

However, I know that not all of them are applicable for my Windows application which only runs on Intel x86 or x64 platforms and only WinXp, Vista, 7 OS.
So which ones are applicable for me?
For example, some MAC encoding, like x-mac-japanese or x-mac-arabic are for MAC only? Or can be used in Windows too?
Or also for UTF-32, it always returns System.NotSupportedException
 
Just because there is a property that can have values set doesn't mean you need to give the end user the ability to set it to all possible values, or any value at all.

The operating system or bitness of the system doesn't make a difference to a code page, a code page is simply a way of encoding non ASCII characters into an ANSI character set.

The easiest answer to this is use a unicode one like UTF-8 and try to pretend code pages don't exist any more.
 
Yes, but for email client is a little different, email clients usually give so many character sets to users to choose! So I want to know which ones to remove, for example, the character sets which have MAC inside them, are available for Windows? What's the meaning of MAC? For target systems?
 
So I want to know which ones to remove
I would say all of them unless you have a bloody good reason to allow a user to choose a code page (in all honesty do your users know what a code page is? Do they care?)

Unless the people receiving the email have a client that can only accept a particular character set then there is probably no real reason to care about this and allowing users to make a selection will simply give them the chance to choose a wrong one.

Just about any mail client in use these days will support some flavour of Unicode (UTF-8 at the very least) which should work just fine, in all honesty I would expect any mail client written in the past 5 or 10 years to support Unicode, the though that there are new clients that don't support Unicode saddens me.
 
Back
Top