[Qt-interest] Accented characters and QDom in Windows
Andreas Pakulat
apaku at gmx.de
Thu Aug 20 23:27:22 CEST 2009
On 20.08.09 15:26:07, Ellen Kestrel wrote:
> Are there other instances when I should be worrying about specifying text
> encodings in cross-platform apps? I have noticed that in display widgets
> the linux apps will display weird characters that the Windows apps won't,
> but I don't know if that's related at all, or if it's just a matter of not
> having Windows configured properly.
That sounds as if this is the text set via things like
QPushButton::setText. If those texts contains characters that are not
part of plain us-ascii you should use the QString::fromXXX functions to
convert the literal text into a QString explicitly and make sure that
the XXX matches the encoding in which you store the file on disk. Your
best option here is to use QString::fromUtf8() and make sure your source
code file is properly encoded as utf-8.
And of course any time you read text files from disk you need to make
sure you know the encoding of them if you don't want to treat them as
pure byte-arrays.
Andreas
--
You will be given a post of trust and responsibility.
More information about the Qt-interest-old
mailing list