Qt-interest Archive, May 2008
QDomElement::setAttribute() and localisation
Message 1 in thread
Hi,
I have a bug report and can't solve it :) The report states that floats stored
via QDomElement::setAttribute() are dependent on localization. Starting the
app with:
LANG=en_US.UTF-8 qlandkarte
will result in xml content like
...
<trkpt lon="8.224537298083305" lat="53.12501879408956" >
...
An starting with:
LANG=de_DE.UTF-8 qlandkarte
will result into:
...
<trkpt lon="8,224537298083305" lat="53,12501879408956" >
...
Obviously the ',' is a bad idea. Funny enought I can't reproduce the bug with
my system (SuSE 10.3). The system producing the bug is Debian (version ???).
I have no clue how to tell QDomElement::setAttribute() to use a '.' instead of
a ','. Do I miss the obvious? Is Debian using an old buggy version? Is there
a XML wizard to help me out of this mess. Please!
Oliver
--
[ signature omitted ]
Message 2 in thread
Hi Oliver,
> I have a bug report and can't solve it :) The report states that floats
> stored via QDomElement::setAttribute() are dependent on localization.
> Obviously the ',' is a bad idea.
why? It's string data. XML doesnt even declare how to write a float.
(xml scheme however says something about expotential values... xml is complex
*sigh*)
> I have no clue how to tell QDomElement::setAttribute() to use a '.' instead
> of a ','.
convert it yourself.
see QString::number ( double n, char format = 'g', int precision = 6 )
"Unlike QLocale::toString(), this function does not honor the user's locale
settings."
so you get a dot.
> Is Debian using an old buggy version?
qmake -v will tell you. note that debian-qt is a fork with its own mailing
list. http://pkg-kde.alioth.debian.org/qtkde.html
I'd guess your suse version is simply older or forked as well. Who knows what
they do downstream. *shrug*
--
[ signature omitted ]
Message 3 in thread
>
> convert it yourself.
> see QString::number ( double n, char format = 'g', int precision = 6 )
LOL, sure doing the obvious. I should have a break :) Thanks!
Oliver
--
[ signature omitted ]