元音变音编码错误!
我检索一个流。 一切正常,但元音变音 (ä,ö,ü,ß) 的编码除外。
什么是
NäüßÖ´sas so viele Umlaute
变成
Nåjuñá´sas so viele Umlaute
我尝试了 Ascii 编码和其他一些编码,如以下源所示
ASCIIEncoding encoder = new ASCIIEncoding();
Encoding enc = Encoding.GetEncoding(28591);
string response = enc.GetString(message, 0, bytesRead);
哪一个能解决我的问题?
I retrieve a stream.
Everything works fine but the encoding of Umlaute (ä,ö,ü,ß).
What is
NäüßÖ´sas so viele Umlaute
becomes
NäüÃôsas so viele Umlaute
I tried Ascii-Encoding and a few other ones as the following source shows.
ASCIIEncoding encoder = new ASCIIEncoding();
Encoding enc = Encoding.GetEncoding(28591);
string response = enc.GetString(message, 0, bytesRead);
Which one will solve my problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我对 .NET 一无所知,但我确实知道 mojibake: 的这种模式
是UTF-8 被误解为 ISO-8859-1。因此,请尝试将您的输入处理为 UTF-8。
I don't know anything at all about .NET, but I do know that this pattern of mojibake:
is characteristic of UTF-8 being misinterpreted as ISO-8859-1. So try processing your input as UTF-8.
以下字符
äüßÖ
都不是 ASCII。您应该使用与它们相同的编码(可能是 UTF-8):
您正在使用的代码页(28591)是 映射到 iso-8859-1,其中包括这些字符,但是它们可能被编码为 UTF-8(或其他 unicode 变体),但不是 iso-8859-1。您需要使用正确的编码才能获得正确的编码字符。
None of the following characters
äüßÖ
are ASCII.You should be using the same encoding that they are in (probably UTF-8):
The codepage you are using (28591) is mapped to iso-8859-1, which includes these characters, however they are probably encoded as UTF-8 (or another unicode variant) but not iso-8859-1. You need to use the right encoding in order to get the correct encoded characters.
如果您需要 8 位编码,请使用支持德语字符的 ISO-8859-2(或 Latin 2)。或者,如果可以的话,使用一些 UNICODE 编码,例如 UTF-8。在后一种情况下,而是让编码器在字符流的开头包含 BOM(字节顺序标记),以便读取或显示输出的应用程序可以正确推断编码。
In case you need 8-bit encoding, use ISO-8859-2 (or Latin 2) which supports German characters. Or, if you can, use some of UNICODE encodings like UTF-8. in the latter case rather let the encoder include the BOM (Byte Order Mark) at the start of the character stream, so that the apps reading or displaying your output can infer the encoding correctly.