Results 1 to 2 of 2

Thread: don't understand Qt's setCodecForCStrings

  1. #1
    Join Date
    Apr 2007
    Posts
    46
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default don't understand Qt's setCodecForCStrings

    Qt Code:
    1. QApplication app(argc, argv);
    2. QTextCodec::setCodecForCStrings(QTextCodec::codecForName("windows-1252"));
    3. QTextCodec::setCodecForLocale(QTextCodec::codecForName("windows-1252"));
    4.  
    5. //...
    To copy to clipboard, switch view to plain text mode 
    Using this code I can display and 'e' with acute by calling
    Qt Code:
    1. QMessageBox::about (this,"About",QString::fromLocal8Bit("\xe9"));
    To copy to clipboard, switch view to plain text mode 
    but "\xe1" for an 'a' with acute won't work.
    On Windows, I get a compiler warning, saying that "hex escape sequence out of range".
    Any workarounds?
    Last edited by ber_44; 9th July 2007 at 01:03.

  2. #2
    Join Date
    Apr 2007
    Posts
    46
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: don't understand Qt's setCodecForCStrings

    Sorry, this was a simple problem. I had a non-hex letter after e acute, and a hex letter after a acute, like "\xe1bbbbbb". The solution: "\xe1" "bbbbbb"

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.