Results 1 to 5 of 5

Thread: QtXml and special characters

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2008
    Posts
    35
    Thanks
    7
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QtXml and special characters

    Hello,

    I'm saving a QList of songs into an XML. That goes well but the loading doesn't work out very well

    When I save for example the song "Björk - It's Oh So Quiet.mp3" you get this in the XML file:
    <song title="It's Oh So Quiet" path="C:\Documents and Settings\Gillis\Mijn documenten\Mijn muziek\Apart\Björk - It's Oh So Quiet.mp3" artist="Björk" album="It's Oh So Quiet" id="66" />.

    When I try to load the path or the artist the 'ö' changes in a '?' or other things...

    This is how I load the attributes:
    Qt Code:
    1. void parseSongElement(const QDomElement &element)
    2. {
    3. int id = element.attribute("id").toInt();
    4. Song* song = new Song(id);
    5. song->path = element.attribute("path");
    6. song->info.title = element.attribute("title");
    7. song->info.artist = element.attribute("artist");
    8. song->info.album = element.attribute("album");
    9. currentPlaylist->append(song);
    10. }
    To copy to clipboard, switch view to plain text mode 
    I have tried using element.attribute("path").toAscii() but that doesn't work either...

    Thanks in advance,
    Gillis
    Last edited by supergillis; 27th September 2008 at 17:13.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.