[xml] xmlDocDumpFormatMemory() UTF-16 problem (bug?)

It appears that xmlDocDumpFormatMemory() doesn't work correctly with
UTF-16 in case if xml file size exceeds approximately 8K.
Output contains some garbage and size grows enormously: when expected
output should be 8001 bytes the real one will take 16K, for 16K it will
be 95K and so on.

It is easy to recreate - just call only two functions with any UTF-16
document larger then 8K:


Looking inside libxml2, I would tell it is something about
"xmlOutputBufferWrite" from xmlio.c,
or "xmlCharEncOutFunc", not sure. This magic number 8000 I believe is
MINLEN x 2 (because UTF-16 takes 2 bytes per char).

I will dig more when I have time.
I'm using 2.5.8 on Windows, no "iconv".


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