On 01/22/2010 09:47 AM, Junping Zhang wrote:
RE: [gmime-devel] What's the preferred way to retrieve message
body?
Thanks for the suggestion. I should read the
archive first next time. I also upgraded
the system to use gmime-2.4.11 to be a bit more future-proof.
I have another newbie question for the list.
When I use gmime-2.0 (stock on FC7), the internet_address_get_name()
returns rfc2047-
decoded string, but that's not true anymore in gmime-2.4. At the same
time, all other
header fields, such as subject, are still automatically
rfc2047-decoded. This can be
seen in gmime-message.c::process_header(), the function
g_mime_utils_header_decode_text()
is not called on the address fields.
It has never been called there because the address parser depends on
those tokens to remain as rfc2047 encoded-word tokens so that it can
more easily parse them. The address parser itself decodes those tokens
once it has finished tokenizing each address.
In internet-address.c, around line 290 in the function
_internet_address_set_name(), it decodes the name using
g_mime_utils_header_decode_phrase() (which is the correct function to
use - header_decode_text() decodes a slightly different syntax).
My guess is that the sample you tested on was broken (maybe it enclosed
the rfc2047 encoded-word token(s) inside quotes?)
Is this a design decision?
Nope.
Should I call g_mime_utils_header_decode_text()
myself to get
rfc2047-decoded sender name?
No, this shouldn't be necessary.
Jeff
|