PDA

View Full Version : Problem with different charsets when reading attachments' names during pop3 session.



kremuwa
8th July 2010, 09:03
Hello,

When I'm analysing content of a mailbox, I send TOP commands to gather some information. For example, on the mailbox, I've got a mail with one attachment called:
"Lily Allen - It's Not Me, It's You [2009].rar"
But when I'm receiving the content of this mail using Qt and POP3 protocol, the filename is:
"=?iso-8859-2?Q?Lily_Allen_-_It=27s_Not_Me=2C_It=27s_You_[2009].rar?="
Another example - the original name of an attachment:
3D_Mario_Forefer.rar
An in Qt it is:
"=?UTF-8?Q?3D=5FMario=5FForefer.rar?="

How to deal with these different charsets? Is there a way to obtain the original filenames from these weird ones?

Thank you in advance for your effort,
Michael.

squidge
8th July 2010, 09:15
Sure, parse the filename in the char set specified. For example, =27 is the hex code for ascii 39 '
=2C is the hex code for ascii 44 ,
etc.

All that is happening is 7-bit encoding.

kremuwa
8th July 2010, 14:34
Is there any convenient function in Qt ready to do just that? I was looking at .fromUtf8, .fromAscii and so on, but I don't really get how they work.

kremuwa
9th July 2010, 21:55
I'd like to refresh the question above.