I have following test program
char c = '§';
Debug.WriteLine("c: " + (int)c);
byte b = Encoding.GetEncoding(437).GetBytes("§")[0];
Debug.WriteLine("b: " + b);
char c1 = Encoding.GetEncoding(437).GetString(new byte[] { 21 })[0];
Debug.WriteLine("c1: " + (int)c1);
This produces following result:
c: 167
b: 21
c1: 21
As I can see here GetBytes is working correctly
167 in unicode => 21 in CP437
but GetString is not working
21 in CP437 => 21 in unicode
Is this a bug or my mistake?
GetBytes
andGetString
return arrays with just a single element? – Junkie?
) in CP437. the placeholder is mapped back to the placeholder in unicode which is 21 too. – ParabolizeGetString
, again out of interest? I don't know the inner workings of these methods but I agree it seems very odd. – Junkie