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



On Fri, Apr 21, 2006 at 06:29:36PM +0200, Roland Schwingel wrote:
Hi... 

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. 

The patch looks fine to me, but I can't speak for the Windows users out there.
So I'm inclined to accept and apply it, but I will wait a bit to see if someone
disagree. If poke me early next week if there is no news and I forgot toi
apply it :-)

  thanks a lot !

Daniel

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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