3

I'd like to retrieve the ANSI code value of a given character. E.g. when I now get the int value of the trademark character, I get 8482. Instead I would like to get 153, which is the value of the trademark character in codepage 1252.

Some help would be appreciated.

Jurgen

jdetaeye
  • 183
  • 1
  • 13

1 Answers1

3

Found it myself:

Encoding ansiEncoding = Encoding.GetEncoding(1252);
byte[] bytes = ansiEncoding.GetBytes(c);
int code = bytes[0];
jdetaeye
  • 183
  • 1
  • 13