[xml] Patch to allow parsing files with pathes containing unicode characters on windows...


First I want to say, libxml2 rocks! I use it very very often and it is very reliable and fast. Thank you all!

But there is a small problem when I use it on windows... I also often have files with unicode characters in
their names. These can at present not directly be loaded by libxml2 (on windows).

While it is possible to read a file to memory using native OS calls and then passing the content to xmlParseMemory()
this still causes overhead especially if you want to parse real big files. So I made a small change to xmlIO.c
allowing libxml2 to read those files directly on windows. This patch is attached to this email.

The API of libxml2 is utf-8 based (from what I understand - and working with pathes containing
uft-8 characters works very well on Linux and Mac).

So I added some windows specific code to xmlIO.c that converts an utf8 string to windows wide character.
This recoded path will then be used to open a file using windows wide character api for reading/writing.
That small and simple.

I am using this patch for quite a while now and it serves it's task very well. I don't know much about the
conventions regarding code writing for libxml2, but I tried as much as possible to not completely break every rule...

I hope you find this patch as useful as I do, and you can incorporate this patch in one of the next versions
of libxml2.



Attachment: xmlIO.c.patch
Description: Binary data

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