IXMLWriter locale

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
minas1
Posts: 35
Joined: Mon May 17, 2010 11:19 am

IXMLWriter locale

Post by minas1 »

Hello. I want to print some values to an xml file using the IXMLWriter interface.
The problem is, because my locale is Greek, fractional numbers use the ',' instead of '.' character. So 1.6 (on USA locale\) would be printed as 1,6.

This is a problem because when I try to load the file later, it expects 1.6 and find 1,6 and all things go wrong. This is my function:

Code: Select all

void CEditorLevel::OnSaveMap()
{
        //write all nodes to one file for now
        setlocale(LC_ALL,"C");
 
        IXMLWriter* writer = m_EditorManager->getDevice()->getFileSystem()->createXMLWriter(m_MapName.c_str());
        writer->writeXMLHeader();
        WriteSceneNode(writer, m_EditorManager->getSceneMngr()->getRootSceneNode());
        writer->drop();
 
}
As you can see I set the default locale before I write to the xml file. But it doesn't work. 1,6 is printed instead of 1.6. Is irrlicht source aware of this? I mean it prints fractional numbers depending on locale or does it print a '.' everywhere?

Is there a way to fix this? Thank you.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: IXMLWriter locale

Post by CuteAlien »

We had that just recently, there is a problem, but it looks like only in combination with FileOpen dialog: http://irrlicht.sourceforge.net/forum/v ... =7&t=44161
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply