Results 1 to 2 of 2

Thread: Wrong charsset foc const QString

  1. #1
    Join Date
    Feb 2011
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Wrong charsset foc const QString

    Hi,

    Usually, for charsset problems we can use theses functions:
    Qt Code:
    1. QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
    2. QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
    3. QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
    To copy to clipboard, switch view to plain text mode 

    However, In my case for a porting Qt3 to Qt4 I have a global constant.
    Qt Code:
    1. const QString myVar = "text with accent é à è"
    To copy to clipboard, switch view to plain text mode 

    In this case the string is interpreted by gcc. Is there any QT DEFINE to force use of UTF-8 ?

    Thanks

  2. #2
    Join Date
    Aug 2009
    Location
    Greece
    Posts
    69
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Wrong charsset foc const QString

    try this
    Qt Code:
    1. const QString myVar (QObject::trUtf8("text with accent é à è"));
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 1
    Last Post: 6th October 2011, 00:13
  2. Replies: 2
    Last Post: 11th August 2011, 15:42
  3. Disturbing: const QString &
    By magland in forum General Programming
    Replies: 9
    Last Post: 28th November 2007, 15:34
  4. QString to const char
    By TheRonin in forum Newbie
    Replies: 2
    Last Post: 12th February 2007, 14:43
  5. How to convert a QString to const char *?
    By SkripT in forum Newbie
    Replies: 2
    Last Post: 10th March 2006, 10:56

Tags for this Thread

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.