Re: [gmime-devel] Decoding UTF-8 headers



Hi Andrew,

On 07/08/2011 08:38 AM, Andrew Victor wrote:
hi,

It seems that when .NET's System.Net.Mail encodes some headers in
UTF-8 format, they cannot be decoded by the GMime library.

Is this Microsoft's System.Net.Mail or Mono's System.Net.Mail or both?

An example header is:

From: =?utf-8?Q?{#D=C3=A8=C3=A9=C2=A3=C3=A5=C3=BD_M$=C3=A1=C3?=

  =?utf-8?Q?=AD.=C3=A7=C3=B8m@#}?=

  <user domain com>

Tested with GMime 2.26, GMime 2.4.14,  Evolution 2.28.3 - only the 1st
part of the address is decoded.
ie, they display:
    "{#Dèé£åý M$á� =?utf-8?Q?=AD. =C3=A7=C3=B8m@ #}?="<user domain com>
rather than:
    {#Dèé£åý M$áí.çøm@#}<user domain com>

If you initialize GMime with g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS); GMime 2.4.x and 2.5.x should both handle the test case you provided. I just tested 2.5.8 and 2.4.25 and it works fine. 2.4.14 may be too old, I'm not sure.

The problem is that periods must be encoded if they are inside an encoded-word token and in your example, that is not the case. The software that produced the encoding has a bug.

Hope that helps,

Jeff



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]