Results 1 to 12 of 12

Thread: QString iso 8859-1 conversion

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QString iso 8859-1 conversion

    I'm still here trying to fix this problem...
    Qt Code:
    1. QString string = "èèèèèè";
    2. QTcpSocket socket;
    3. QTextStream inSendMessage ( & socket );
    4. inSendMessage << string.toLatin1() << endl;
    To copy to clipboard, switch view to plain text mode 
    I receive strange char...maybe does the socket do an ASCII 7bit conversion?

    The server is developed with Qt3...maybe there is a charset encoding problem between them?
    Last edited by mattia; 16th January 2008 at 11:26.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QString iso 8859-1 conversion

    Are you sure you create that QString properly? What encoding do you use for "èèèèèè"?

  3. #3
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QString iso 8859-1 conversion

    to know what codec i'm using have i to use QTextCodec::codecForCStrings() ?
    but it's return a *QTextCodec ... isn't there a sort of toString() method to print the codec name?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QString iso 8859-1 conversion

    Quote Originally Posted by mattia View Post
    but it's return a *QTextCodec ... isn't there a sort of toString() method to print the codec name?
    You can try QTextCode::name() or QTextCodec::aliases(), but better simply set the right codec using QTextCodec::setCodecForCStrings().

Similar Threads

  1. UTF8 to ISO 8859... conversion
    By claudio in forum Qt Programming
    Replies: 3
    Last Post: 29th December 2007, 21:24
  2. Convert from iso-8859-1 to... Something else :-)
    By Nyphel in forum Qt Programming
    Replies: 4
    Last Post: 7th March 2007, 17:59
  3. conversion from QString to const uint8 *
    By vishal.chauhan in forum Qt Programming
    Replies: 3
    Last Post: 19th February 2007, 13:14
  4. Converting QString to unsigned char
    By salston in forum Qt Programming
    Replies: 3
    Last Post: 24th April 2006, 22:10
  5. [SOLVED] Widget plugin ... how to ?
    By yellowmat in forum Newbie
    Replies: 10
    Last Post: 29th January 2006, 20:41

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.