How to convert Extended ASCII to decimal in Windows Forms C#?

后端 未结 3 398
予麋鹿
予麋鹿 2021-01-28 02:04

I am writing a windows application. am facing problem in converting Extended ASCII[128-256] to its decimal equivalent.

when i receive the extended ASCII

3条回答
  •  日久生厌
    2021-01-28 02:18

    I think you are looking for something like this

        String str="œ";
        var bytes = Encoding.GetEncoding("Windows-1252").GetBytes(s);
        string binStr = string.Join("", bytes.Select(b => Convert.ToString(b, 2)));
        int decimalEquivalent=Convert.ToInt32(binStr,2);
        Console.WriteLine(decimalEquivalent);
    

    this is working for ASCII [128-255]

提交回复
热议问题