Re: [gmime-devel] What's the preferred way to retrieve message body?



Junping Zhang wrote:
>
> > My guess is that the sample you tested on was broken (maybe it enclosed
> > the rfc2047 encoded-word token(s) inside quotes?)
>
> That is it! Once I removed the outside quotes, it worked. I just read
> RFC2047 again and here we have
>
>    + An 'encoded-word' MUST NOT appear within a 'quoted-string'.
>
> Looking at the samples I download now, I can see _a lot_ of them use
> quotes
> around RFC2047 encoded words. That includes emails from yahoo, hotmail and
> a bunch of others. I can't be sure it's from users' own MUA or through
> some
> webmail interface, though. I know gmime wants to stick with the standards
> but what should be the approach if I still want to process those emails?
>

I guess there are (at least) 2 options:

1. You could check the string returned from internet_address_get_name()
and if it appears to be encoded, call
g_mime_utils_header_decode_phrase() on it (and then optionally set it on
the InternetAddress again).

2. GMime already has an initialization flag
GMIME_INIT_ENABLE_RFC2047_WORKAROUNDS which work around some rfc2047
encoding brokenness. Perhaps this flag can also be made to mean ignore
the no-encoded-words-in-qstrings rule in internet addresses (which would
basically just do option #1 automatically), assuming the code doesn't
already do that (I don't think it does, but it's been a while since I've
looked at that code).

(Note: I suppose we could also add a separate flag for this 'feature')

Jeff



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