Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我得到一个 UTF8 格式的流,但我想得到 UTF16 格式的流,因为我在 C# 中得到了一些不受支持的国际字符。我如何实现这一目标
如果您获得不受支持的国际字符,您可能想要使用的编码不是 UTF16:iso-8859-1
UTF16
iso-8859-1
它正确编码字符,例如:æ、ø、å
因此,当您声明您StreamReader想要设置要使用的编码时:
StreamReader
var sReader = new StreamReader(hResponse.GetResponseStream, Encoding.GetEncoding("ISO-8859-1"));
希望这可以帮助。