1

How to recognize code page of input string, for example if I put something in Cyrillic it should return windows-1251 and when I put string in Chinese it return other code page etc

netmajor
  • 6,507
  • 14
  • 68
  • 100
  • Related question - http://stackoverflow.com/questions/90838/how-can-i-detect-the-encoding-codepage-of-a-text-file – Oded Jul 28 '10 at 08:10
  • It's not just related, it looks like the same question. The only difference is the source of the characters. – cHao Jul 28 '10 at 08:26

1 Answers1

2

If this is an input from a textbox (windows forms) the string is a .Net string, and is always in unicode (UTF-16).

If you get the input from a Web form (aspx) page, the browser also sends the codepage with it. And .Net will make it unicode for you.

If you get the input from a file, I wish you good luck ;-).

Community
  • 1
  • 1
GvS
  • 52,015
  • 16
  • 101
  • 139