I'm developping a video game with irrlicht which aims to be cross platform.
Up until now this was going smoothly thanks to irrlicht philosophy ... I had same results on both windows and mac os X.
I then wanted to use xml for serialization/deserialization purposes. It works really fine on windows, unix ... etc working on x86 but the xml generated by irrlicht xmlWriter is unreadable on mac os X.
It looks like this :
http://kschn.free.fr/Docs/Image%201.png
There's some weird characters ... and there's also a lot of characters missing from what the file should be. Textmate (the notepad screen you see) is able to open utf-8 utf-16 big endian and little endian, but I tested all those modes and the file is still unreadable. So It may be a writer problem ...
I believe this is because my machine is a ppc and so is a big-endian not a little-endian like the x86 are.
Is the xmlWriter trully not big-endian compatible or am I missing the point here ?
Is there a simple way to solve this problem ?
XMLWriter and Big-Endian
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
The XML implementation claims to be compatible with UTF variants etc, but what it really does is to write the two first bytes to the file assuming this is UTF-16. So it completely trashes all your output (because the first two bytes is no good choice on OSX which uses 32bit wchar_t and the better byte ordering )
So basically the XML implementation is not working on big endian systems and could easily break on all Linux/Unix systems for non-ASCII characters. However, Irrlicht does not handle those chars correctly in other situations, too, so nothing lost there (but much to improve)
I have an untested fix to make the Linux/Unix versions use UTF-32 which could also help for your problems because with the correct header the endianess should be correctly recognized. I'll post the patch when I'm home so you could try it on your own.
So basically the XML implementation is not working on big endian systems and could easily break on all Linux/Unix systems for non-ASCII characters. However, Irrlicht does not handle those chars correctly in other situations, too, so nothing lost there (but much to improve)
I have an untested fix to make the Linux/Unix versions use UTF-32 which could also help for your problems because with the correct header the endianess should be correctly recognized. I'll post the patch when I'm home so you could try it on your own.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
YOu can find a patch under http://parsys.informatik.uni-oldenburg. ... iter.patch