Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. TextStream special characters
Qt 6.12 LTS is out! See what's new in the release blog

TextStream special characters

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 3.0k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    if a line (string) of my file contains a special character, it will be written as a odd code into a new file. how to fix it?

    @
    QString line = pathInput.readLine(); // line == "hi. chi è? ügo de gerò"
    QTextStream out(pathOut);
    out << line; // hi. chi A̴ (for example...)
    @

    EDIT: please use @-tags for code highlighting, gerolf

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      Set the proper encodings for incoming and outgoing files. Have a look at "QTextStream::setCodec()":http://doc.trolltech.com/latest/qtextstream.html#setCodec.

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

      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
      • Unsolved