Results 1 to 2 of 2

Thread: QString Special Character Problem

  1. #1
    Join Date
    Jul 2010
    Posts
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default QString Special Character Problem

    Hi,
    I have a problem with Turskish special characters, especially 'ı' (not 'i') in QStrings.
    The exact problem is that, I must handle upper-to-lower/lower-to-upper conversions for any strings which may even include those special characters. For an example, I'd like to convert the word "Image" into "ımage", not to "image" etc.
    Any help welcome.

  2. #2
    Join Date
    Mar 2011
    Location
    Havana, Cuba
    Posts
    17
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    3

    Default Re: QString Special Character Problem

    Try to do this in your main loop:

    Qt Code:
    1. #include <QTextCodec>
    2.  
    3. int main(int argc, char *argv[])
    4. {
    5.  
    6. QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
    7. QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
    8. QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
    9.  
    10. QApplication a(argc, argv);
    11. Agenda w;
    12. w.show();
    13.  
    14. return a.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 

    I did it for some especial spanish characters and it work out, maybe in your case the locale to use is not UTF-8, so you should try with another locale, but I think that it could be the solution, so you try and let us know if it work.

Similar Threads

  1. Replies: 5
    Last Post: 8th September 2011, 11:38
  2. Replies: 2
    Last Post: 6th March 2011, 17:18
  3. Replies: 8
    Last Post: 14th April 2010, 06:54
  4. Special character's HTML entity to string
    By Hiba in forum Qt Programming
    Replies: 4
    Last Post: 3rd March 2009, 15:05
  5. Special Character Handling
    By Kubil in forum Qt Programming
    Replies: 1
    Last Post: 22nd June 2008, 23:58

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
  •  
Qt is a trademark of The Qt Company.