MimeParser icon indicating copy to clipboard operation
MimeParser copied to clipboard

Encoded words support

Open Herz3h opened this issue 5 years ago • 1 comments

First of all thank you for this library. I've used it to retrieve some headers, and I stumbled upon a header that contained UTF-8 data, is there a way to decode this header using this library ?

Format seems to be ?=encoding?charset?mytexthere?=

Thank you.

Herz3h avatar Oct 25 '19 12:10 Herz3h

Seems to be documented in this RFC:

https://www.rfc-editor.org/rfc/rfc2047.html

I would also like to see this added. There is some code here that may be a good starting point:

https://github.com/bengottlieb/marcel/blob/master/Source/Marcel/String%2BMime.swift

I had to fix this code like so:

        while let range = result.range(of: utf, options: .caseInsensitive),
              let endRange = result[range.upperBound...].range(of: utfEnd),
              range.upperBound < endRange.lowerBound, !done {

pcbeard avatar May 04 '22 05:05 pcbeard