确定文本编码
我收到一些奇怪的字符作为对网页的响应。我很确定这是一条俄语消息,但编码似乎很奇怪。网页信息告诉我编码是 ISO-8859-1。这是响应示例。
Âû ñòðàíè÷êå ïðåâüþøêàìè
有没有办法解密这个响应?响应是否可以挽救?
I'm getting some weird characters as a response to a webpage. I'm pretty sure its a message in Russian language, but the coding seems to be all weird. The webpage info tells me the the encoding is ISO-8859-1. Here is the sample response.
Âû ñòðàíè÷êå ïðåâüþøêàìè
Is there a way to decrypt this response? Is the response salvageable at all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来编码实际上是西里尔文Windows-1251。相应地切换您的网络浏览器编码。
例如,您在该编码中提供的文本是:
自动翻译表示“您页面预览”。
It looks like the encoding is actually Cyrillic Windows-1251. Switch your web-browsers encoding accordingly.
For example, the text you supplied in that encoding is:
which an auto-translation says means "You page previews".
自动识别 8 位编码几乎是不可能的,因为所有字节组合在技术上都是有效的。在这种情况下,我很确定它是 Windows-1251,因为字符是那里很有意义:
显然不是 ISO-8859-1。
要将其转换为 Unicode 字符串,请使用
decode
方法:It is hardly possible to automatically recognize 8-bit encodings because all byte combinations are technically valid. In this case, I'm pretty sure it is Windows-1251, because the characters are quite meaningful there:
It's clearly not ISO-8859-1.
For converting this into a Unicode string, use the
decode
method: