Results 1 to 4 of 4

Thread: QString::fromUtf8 problems converting micro sign

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QString::fromUtf8 problems converting micro sign

    The Unicode code point for the "Micro sign" is \u00b5. In UTF-8 encoding this is a two byte sequence \xc2\xb5. You could also use Greek small letter mu \u03bc.

    Any of these:
    Qt Code:
    1. QString s(QChar(0x00b5));
    2. QString s = QString::fromStdWString(L"\u00b5");
    3. QString s = QString::fromUtf8("\xc2\xb5");
    To copy to clipboard, switch view to plain text mode 

    This works for me but I am not sure if it is by-design or by-accident:
    Qt Code:
    1. QString s = QString::fromUtf8("\u00b5");
    To copy to clipboard, switch view to plain text mode 

    Look up Unicode code points here: http://www.unicode.org/charts
    Convert into a bucket of other forms here: http://people.w3.org/rishida/tools/conversion/
    Last edited by ChrisW67; 10th February 2011 at 00:32.

  2. #2
    Join Date
    Feb 2007
    Posts
    73
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QString::fromUtf8 problems converting micro sign

    Thanks! This is a big help.

Similar Threads

  1. converting uint to QString
    By Yayati.Ekbote in forum Newbie
    Replies: 1
    Last Post: 14th April 2010, 13:43
  2. Converting QString to char* in onl line
    By hubbobubbo in forum Qt Programming
    Replies: 10
    Last Post: 11th December 2009, 11:45
  3. Converting a QString to a LPCTSTR?
    By dobedidoo in forum Qt Programming
    Replies: 3
    Last Post: 7th December 2009, 14:27
  4. Converting u_char to QString
    By merlvingian in forum Newbie
    Replies: 7
    Last Post: 29th September 2006, 00:11
  5. QString to char* not converting
    By DPinLV in forum Qt Programming
    Replies: 17
    Last Post: 6th August 2006, 12:15

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