[Qt-interest] Accented characters and QDom in Windows

Andreas Pakulat apaku at gmx.de
Thu Aug 20 17:50:01 CEST 2009


On 20.08.09 10:33:04, Ellen Kestrel wrote:
> I compiled an application I wrote in linux under Windows the other day, and
> there seems to be a problem with the QDom classes I'm using to read and
> write files and accented characters.  If I enter in (say) "á" into the
> program, save it to a file (where it still appears as "á") and then load it
> back into the program, the program now displays it as a box, and the
> text-parsing parts of the program do not recognize it as "á".  If I replace
> the "á" in the XML file with the appropriate entity (in the form of &#XXX;)
> it reads it just fine.  This problem does not occur in linux.

Sounds like you've got a pretty nice encoding issue there. That is, your
XML gets saved to disk in encoding A, but when you read it back in you're
using encoding B. Luckily xml files contain an encoding tag (or default to
utf-8), so this should be easily fixable. To help you I suggest to show us
the code that reads the xml (from the point where you have a filename in a
string to the point where the dom-document is created) and the code that
saves it to a file (from the point where populating the dom is done until
the file is closed).

Andreas

-- 
You like to form new friendships and make new acquaintances.



More information about the Qt-interest-old mailing list