Results 1 to 7 of 7

Thread: Make QTextStream write with UTF8 enabled?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Make QTextStream write with UTF8 enabled?

    No, my friend, my question is clear. i want the greek characters (the char* realpath) to be written to the file `home16` WITHOUT to turn into "chinese" (I mean weird symbols etc)
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  2. #2
    Join Date
    Nov 2010
    Posts
    97
    Thanks
    6
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Make QTextStream write with UTF8 enabled?

    Quote Originally Posted by hakermania View Post
    No, my friend, my question is clear. i want the greek characters (the char* realpath) to be written to the file `home16` WITHOUT to turn into "chinese" (I mean weird symbols etc)
    Well, if it was clear I wouldn't be explaining what I didn't understand...but oh well.

    Have you tried converting your byte sequence into a QString using the appropriate ::from XXX function? For instance, if your byte sequence is in UTF-8 then my guess would be that you'd get better results with:
    Qt Code:
    1. out << QString::fromUTF8(realpath);
    To copy to clipboard, switch view to plain text mode 

    Also, not all programs are going to display your text output correctly. You'll need something specifically able to deal with Unicode and have the right font loaded, etc... It is possible that you've already gotten correct output but are looking at it with something not smart enough to read it correctly.

  3. The following user says thank you to nroberts for this useful post:

    hakermania (28th December 2010)

  4. #3
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Make QTextStream write with UTF8 enabled?

    Thank you, this worked
    And a note: LINUX are not as WINDOWS, they have programs that CAN read Unicode Characters HAHAHA
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  5. #4
    Join Date
    Nov 2010
    Posts
    97
    Thanks
    6
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Make QTextStream write with UTF8 enabled?

    Quote Originally Posted by hakermania View Post
    Thank you, this worked
    And a note: LINUX are not as WINDOWS, they have programs that CAN read Unicode Characters HAHAHA
    That actually used to be fairly difficult to get working correctly. Glad to see that it's improved.

  6. #5
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Make QTextStream write with UTF8 enabled?

    If you are talking about a GUI program that could read unicode, you're right, but as long as I use Linux, nano and vim read unicode perfectly.
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

Similar Threads

  1. Replies: 2
    Last Post: 2nd November 2010, 05:15
  2. Replies: 4
    Last Post: 9th August 2009, 01:04
  3. How to write to a TCPSocket with a QTextStream?
    By Denarius in forum Qt Programming
    Replies: 3
    Last Post: 8th May 2009, 12:28
  4. Read/Write from QTextStream
    By tonde in forum Qt Programming
    Replies: 7
    Last Post: 31st July 2008, 16:51
  5. QTableWidgetItem not enabled
    By Raccoon29 in forum Newbie
    Replies: 2
    Last Post: 21st March 2008, 18:39

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.