什么是“=C2=A0”?在 MIME 编码、引用的可打印文本中?
这是我试图解析的原始电子邮件示例:
MIME-version: 1.0
Content-type: text/html; charset=UTF-8
Content-transfer-encoding: quoted-printable
X-Mailer: Verizon Webmail
X-Originating-IP: [x.x.x.x]
=C2=A0test testing testing 123
什么是 =C2=A0?我已经尝试了六个引用可打印的解析器,但没有一个正确处理这个问题。 如何在 C# 中正确解析此内容?
老实说,现在我正在编码:
//TODO WTF
encoded = encoded.Replace("=C2=A0", "");
因为我无法弄清楚为什么该文本会随机出现在 MIME 内容中,并且不应该出现被渲染成任何东西。通过删除它,我就得到了想要的效果 - 但为什么?!
需要明确的是,我知道 (=[0-9A-F]{2}) 是一个编码字符。但在这种情况下,它似乎代表不了什么。
This is an example raw email I am trying to parse:
MIME-version: 1.0
Content-type: text/html; charset=UTF-8
Content-transfer-encoding: quoted-printable
X-Mailer: Verizon Webmail
X-Originating-IP: [x.x.x.x]
=C2=A0test testing testing 123
What is =C2=A0? I have tried a half dozen quoted-printable parsers, but none handle this correctly. How would one properly parse this in C#?
Honestly, for now, I'm coding:
//TODO WTF
encoded = encoded.Replace("=C2=A0", "");
Because I can't figure out why that text is there randomly within the MIME content, and isn't supposed to be rendered into anything. By just removing it, I'm getting the desired effect - but WHY?!
To be clear, I know that (=[0-9A-F]{2}) is an encoded character. But in this case, it seemingly represents NOTHING.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
=C2=A0
表示字节 C2 A0。由于这是 UTF-8,因此它会转换为 U+00A0,这是不间断空格的 Unicode。请参阅UTF-8(维基百科)。
=C2=A0
represents the bytes C2 A0. Since this is UTF-8, it translates to U+00A0, which is the Unicode for non-breaking space.See UTF-8 (Wikipedia).
%C2%A0 是不间断空格
%C2%A0 is a non breaking space
%C2%A0 这是隐藏文件夹的代码,创建一个隐藏文件夹并保存在里面,比如一个文本文件,然后通过浏览器打开这个文件,你就会在搜索栏中看到这些字符。据我了解,这些字符是可选的,不会转换为其他代码。
%C2%A0 This is the code of a hidden folder, create a hidden folder and save in it, for example, a text file, then open this file through a browser and you will see these characters in the search bar. As I understand it, these characters are optional and do not translate to other code.