extended-ascii

How can I convert extended ascii to a System.String?

淺唱寂寞╮ 提交于 2019-11-27 21:15:51
For example: "½" or ASCII DEC 189. When I read the bytes from a text file the byte[] contains the valid value, in this case 189. Converting to Unicode results in the Unicode replacement character 65533. UnicodeEncoding.Unicode.GetString(b); Converting to ASCII results in 63 or "?" ASCIIEncoding.ASCII.GetString(b); If this isn't possible what is the best way to handle this data? I'd like to be able to perform string functions like Replace(). Byte 189 represents a "½" in iso-8859-1 (aka "Latin-1"), so the following is maybe what you want: var e = Encoding.GetEncoding("iso-8859-1"); var s = e

How can I convert extended ascii to a System.String?

丶灬走出姿态 提交于 2019-11-27 04:29:36
问题 For example: "½" or ASCII DEC 189. When I read the bytes from a text file the byte[] contains the valid value, in this case 189. Converting to Unicode results in the Unicode replacement character 65533. UnicodeEncoding.Unicode.GetString(b); Converting to ASCII results in 63 or "?" ASCIIEncoding.ASCII.GetString(b); If this isn't possible what is the best way to handle this data? I'd like to be able to perform string functions like Replace(). 回答1: Byte 189 represents a "½" in iso-8859-1 (aka