views:

230

answers:

1

Hi,

How can I see if the input string is a two byte character or one byte character; and from which encoding system the character is coming from?

I am using C# and SilverLight; I assume I could find the encoding the computer is running and then the character? Any code snippet?

Thank you, Rune

// Get a UTF-32 encoding by codepage.Encoding Encoding_12000_instance = Encoding.GetEncoding(12000);

// Get a UTF-32 encoding by name.Encoding Encoding_UTF32_instance = Encoding.GetEncoding("utf-32");

+2  A: 

everything that is string in .net is in UTF-16. If you are getting input from other sources you need to get encoding name from it.

Andrey
Yep. If you want to see if it's Basic Latin, just check the character range.
Steven Sudit