aenetmail icon indicating copy to clipboard operation
aenetmail copied to clipboard

Underscore replaced by space in email body

Open smurfpandey opened this issue 11 years ago • 3 comments

I noticed that all underscore characters are getting replaced by a space. We have a workflow where we are reading URL from the email body, but all URLs with underscore are broken after reading via the our app. e.g Actual URL in email:

http://en.m.wikipedia.org/wiki/Google_Web_Server

URL read by the app:

http://en.m.wikipedia.org/wiki/Google Web Server\r\n

smurfpandey avatar Apr 14 '14 07:04 smurfpandey

The 'Q' encoding used in rfc2047 headers uses underscores to encode spaces for easier legibility. The Content-Transfer-Encoding: quoted-printable encoding does not do this and has other differences as well.

Currently the code uses Utilities.DecodeQuotedPrintable() for both cases and here's where underscores are converted to spaces:

https://github.com/andyedinborough/aenetmail/blob/master/Utilities.cs#L241

As a quick and dirty hack, you could probably modify DecodeQuotedPrintable to take a boolean arg to specify if it should decode underscores and then modify the code that uses it to pass the correct true/false value.

jstedfast avatar May 13 '14 10:05 jstedfast

I was aware of this function, but wasn't sure how it works. Will do a quick hack myself now.

smurfpandey avatar May 13 '14 15:05 smurfpandey