+1 vote

hi i have a problem to check atatchments .filename (and to compare it with a greek name) when it uses greek characters . is there any way to accomplish this task?
it returns some strange characters

by
retagged by
Mail.dll has full support of national characters. Both in email bodies and headers. The email may be incorrectly formatted.

Please provide some more details:
- Are you sending or receiving email message?
- Possibly add raw eml version of the message.
- What exactly do you mean when you say you have problem with comparing?
- Does the filename look correct when you examine MimeData.FileName property under debugger?
The correct attachment filename is "Εθνική πιστωτικά 15-10-2012"
When i debug it i got as name "Εθνι&&Πιστωτικά 15-10-2012"
and when i save the attachment from mac mail client i get a totally strange name (?B?zrHMgSAxNS0xMC0yMDEyLnBkZg=.pdf). Here's the attachment header:

Content-disposition: attachment;
 filename*0*=utf-8''%CE%95%CE%B8%CE%BD%CE%B9%CE%BA%CE;
 filename*1*=%B7%CC%81%20%CF%80%CE%B9%CF%83%CF%84%CF%89;
 filename*2*=%CF%84%CE%B9%CE%BA%CE%B1%CC%81%2015-10-2; filename*3=012.pdf

1 Answer

+1 vote
 
Best answer

The problem is with how email sending application split the file name parameter of Content-Disposition header:

Content-disposition: attachment;
 filename*0*=utf-8''%CE%95%CE%B8%CE%BD%CE%B9%CE%BA%CE;
 filename*1*=%B7%CC%81%20%CF%80%CE%B9%CF%83%CF%84%CF%89;
 filename*2*=%CF%84%CE%B9%CE%BA%CE%B1%CC%81%2015-10-2; filename*3=012.pdf

National characters in UTF-8 encoding, take more then one byte. The first split is not done on a character boundary, but in the middle of a 2-byte character:

..................................................%CE;
  filename*1*=%B7......................................;

CEB7 is 2 byte hex representation of a single character ('θ'). I'm not 100% sure if this is allowed by RFC2231.

Similar situation occurring with 2 adjacent encoded words is for sure not allowed, but it is recognized by Mail.dll.

We'll improve the parser to handle such situations.

[Edit]
The latest version handles such emails correctly.

by (297k points)
selected by
...