I have applied your
patch and it seems to be correct now.
And your changes are
better than mine, because you use the native Windows function GetACP()
instead of g_get_charset() which doesn't seem to work correct on Windows
Server 2008. That was one of the problems I'm fighting with on Friday.
On my developer
maschine with Windows XP my workaround works like expected but if I run it
on a Windows Server 2008 maschine the g_get_charset() function does not
return the correct charset I think - I could not verify this in deep, but
after using GetACP() it works.
Another weird thing
is that if I call g_mime_parser_construct_message() twice for the same eml
file (in different functions and everytime surrounded with g_mime_init() and
g_mime_shutdown()) the second time the library hangs at the same iconv
call.
But now the errno
is E2BIG which is incorrect because all the buffers seem to be
ok.
This happen only if
the gmime tries to convert from UTF-8 to UTF-8 - so I decided to change the
order of the calls in g_mime_utils_decode_8bit() function - by adding the
locale charset to the charsets array first.
if (!(included
& USER_CHARSETS_INCLUDE_LOCALE))
charsets[i++] =
locale;
if (!(included
& USER_CHARSETS_INCLUDE_LATIN1))
charsets[i++] =
"iso-8859-1";
if (!(included
& USER_CHARSETS_INCLUDE_UTF8))
charsets[i++] =
"UTF-8";
The strange thing is,
that this is not reproducable with any eml file - I've found only one which
results in the hang. I have attached the file - so maybe you are able to
find a better workaround for that.
Maybe this is a
problem with my code - it not clear to me which memory I have to free or
not.
Here is what I'm
calling:
[snip]