Decoding a utf-8 encoded mail subject

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nero120
Forum Newbie
Posts: 1
Joined: Tue Mar 14, 2006 5:32 am

Decoding a utf-8 encoded mail subject

Post by nero120 »

Hi guys, this is my first post, but this site has helped me many times already!

I'm writing my own PHP webmail client but Im having a problem with multipart message subjects. I can get most of the subject fine, but sometimes there are weird characters that don't get decoded properly, and i don't know how to decode them into plain text. For example:

Code: Select all

=?UTF-8?Q?Halifax_Promotion_=E2=80=93_Be_prepar?= =?UTF-8?Q?ed_for_the_end_of_the_tax_year?=
I can decode to:

Code: Select all

Halifax Promotion – Be prepared for the end of the tax year
by using imap_mime_header_decode, but whats with that dirty –? I can't find a way to decode that character properly (i think it's supposed to be a hyphen from looking at my osx mail client).

If anyone can help me with this that would be wonderful!
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

It's "en dash" (hyphen)
U-00002013 E2 80 93 EN DASH
Post Reply