I’m newbie with Objective-C and Cocoa. But i develop simple mail client. And i have some problem with encoding.
MIME headers may look like this:
From: =?UTF-8?B?eWVsbA==?= <example@mail.com>
Subject: =?UTF-8?B?0J/RgNC+0LLQtdGA0LrQsCDRgdCy0Y/Qt9C4?=
or like this:
Subject: =?KOI8-R?B?zc7F?=
From: user <example@mail.com>
or like this:
Subject: test subject
From: testname <example@mail.com>
So as you see, if it’s not ASCII string, it’s have following format:
=?{charset}?{B or Q}?{Base64 or Quoted-printable encoded string}?=
So after base64 decoding we know charset of this string.
Is there analog of PHP function iconv(), for example. Or how to make coversion between different charsets in Objective-C?
You could use these two NSString methods