Re: [gmime-devel] Email parsing functions flawed and not practical to use



On 08/26/2010 10:38 AM, Jeff Stedfast wrote:
> On 08/26/2010 09:00 AM, Damian Pietras wrote:
>   
>> On Thu, Aug 26, 2010 at 02:34:42PM +0200, Damian Pietras wrote:
>>   
>>     
>>>> The good news is that I *think* that the following example should be
>>>> doable...
>>>> Email: "=?ISO-8859-2?Q?TEST?=" <p p org>
>>>>
>>>> This last one will likely require changes to header_decode_phrase().
>>>> I'll try looking into this one in the next few days.
>>>>       
>>>>         
>>> I think it's just matter of unquoting strings before decoding encoded
>>> words. _internet_address_decode_name() should only do decoding,
>>> unquoting should be done only in decode_address(). Since it uses
>>> decode_word() that handles unquoting it should work, but I don't know
>>> why it's not true.
>>>     
>>>       
>> Attached is my proposition (a patch against your patched version).
>>   
>>     
> Instead of manually unquoting each qword as they are tokenized, you
> could just swap unquote_string() to be called *before* decode_phrase().
>
> As it turns out, doing that fixes your other two examples as well (well,
> more-or-less - the results should be acceptable in any case).
>
> Attached is the new patch (in case I made other changes since the
> previous one, I can't recall).
>
> Hope this works out for you,
>   

Found a few buglets in that patch and committed my final version to git
(master and gmime-2-4 branches) along with a few more test cases from
rfc5322.

git clone git://git.gnome.org/gmime
cd gmime && git checkout -b gmime-2-4 origin/gmime-2-4

If that works for you I'll roll a new release,

Jeff



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