Question

I have an e-mail body (char[] buffer, retrieved via POP3), it apparently uses some markup for ISO code pages, e.g. a subject like

Daß ißt ään schlümmer Test

is encoded as

=?iso-8859-1?Q?Da=DF_i=DFt_=E4=E4n_schl=FCmmer_TDest

Is there anything pre-made I can use to turn that into a (readable) CStringW?

(Environment: Win32, C++, VC2008.)

Was it helpful?

Solution

This format is called an encoded-word and is defined by RFC 2047. The form is =?<charset>?<Q or B>?<encoded data>?=, where the data is encoded as either base-64 (B) or something that looks like quoted-printable (Q) but isn't quite (because _ means a space).

Some example C++ decoders will get you to a byte string. You'd then have to decode using the charset to get a Unicode string.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top