Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is "=C2=A0" in MIME encoded, quoted-printable text?

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.

like image 460
TheSoftwareJedi Avatar asked May 05 '10 15:05

TheSoftwareJedi


2 Answers

=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).

like image 110
Steven Sudit Avatar answered Nov 02 '22 09:11

Steven Sudit


%C2%A0 is a non breaking space

like image 2
Yi Yang Avatar answered Nov 02 '22 10:11

Yi Yang