Email decoding issues

I know, there are a few threads flying around explaining problems of getting the right encoding of an email message. I must confess I couldn’t get my head around them fully. Some messages are working nicely, but then there’s supposedly UTF8-encoded mails which don’t look right. If you managed this successfully; I would welcome any hint on how to.

What is “don’t look right”? Do you have diamonds or some strange characters? Or do you have structural problems?

How do you parse your emails? From what I have seen Curl has a simple parser. Chilkat has a more advanced parser. But I had to abandon this and will have to walk the structure with my own code because some emails are more complex than what Chilkat parser handles.

It really depends on what you want to do. If you want to handle some mails then Curl or the existing Chilkat parser should be fine. If you want to do an email client like I do then welcome to guessing.

Thanks a lot, Beatrix! Basically I want to be able to display contents of received mails, but I am not going to write an email client. For some mails my basic decoding works nicely, others are missing EndOfLines or show the internet encoding of umlauts and similar characters, and I could not find any hint on how to find the correct encoding without guessing and examining the text on my own.

I thought that Kem’s M_String module could help, but I couldn’t figure out how to use it for that purpose – at least I could see no change in the results. I was not aware that Curl has a parser for that purpose, and I certainly want to avoid having to explore that stuff all on my own (or buy another plugin just for a detail of one project). So thanks again; I’ll look into Curl.

Upload some mails and show us how you parse the mails.

The most important field for this is content-transfer-encoding. Which may be in the main header. Or it may be set in a mail part. It may be correct or it could be false. The html of the content might show a different value.

if you parse email with one of the email plugins, they should handle encoding well and give you correctly encoded text.

see for MBS Plugins:

I wish I had a good overview on your plugins, Christian! It’s simply too many :wink:
Thx a lot, I’ll give them a try!