Results 1 to 2 of 2

Thread: QString to unicode characters

  1. #1
    Join Date
    Mar 2006
    Location
    Moldova
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QString to unicode characters

    Hi.

    I have for example the string:

    Qt Code:
    1. QString str = QString("string_тест") // There are russian characters in it
    To copy to clipboard, switch view to plain text mode 

    I need to make it look like this: "string_\u0442\u0435\u0441\u0442"

    May be there is a function in Qt to make this ?
    All Rights Reserved ...

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QString to unicode characters

    you can take a single QChar and convert it.

    QString s = ...;
    s = "\\u"+QString::number(s[3].unicode) +........ ;

Similar Threads

  1. QString to Unicode to char*
    By Daxos in forum Newbie
    Replies: 7
    Last Post: 4th November 2010, 18:56
  2. QString and Unicode
    By juanjo_de_la_pradera in forum Qt Programming
    Replies: 0
    Last Post: 23rd September 2010, 14:38
  3. QString unicode problem
    By kemp in forum Qt Programming
    Replies: 6
    Last Post: 21st September 2010, 16:11
  4. Unicode/ASCII characters in QTextStream
    By yren in forum Qt Programming
    Replies: 3
    Last Post: 23rd November 2009, 19:25
  5. Insertion of unicode characters into database oracle through pro c
    By hemananda choudhuri in forum Qt Programming
    Replies: 1
    Last Post: 8th January 2007, 11:42

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.