Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDomDocument & Encoding
Forum Updated to NodeBB v4.3 + New Features

QDomDocument & Encoding

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NoFreeUsername
    wrote on last edited by
    #1

    Hello,

    i have a strange behavior... i have a XML File which is saved in ANSI but it has the <?xml ... encoding="utf-8">.
    In this XML there are special characters like ü (\xf6, 246).

    I could live with it if i get the Byte Value... but the QDomDocument setContent with QFile gets only unusable Bytes.
    How can i fix these wrong special characters? Its basically a Ansi File... should i overwrite it beforehand?
    Reading with QT as ANSI... fixing all issues and writing again? But you dont know if this is a ANSI File or not. Is there a way to check the Encoding for a File? It feels weird to do that.

    @ QDomDocument doc("mydocument");
    QFile file(xmlfile);
    if (!file.open(QIODevice::ReadOnly))
    return NULL;

    if (!doc.setContent(&file))
    {
        file.close();
        return NULL;
    }
    file.close();@
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved