Results 1 to 5 of 5

Thread: Khmer Unicode Problem with Qt 4.7/QTextEdit

  1. #1
    Join Date
    May 2011
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Khmer Unicode Problem with Qt 4.7/QTextEdit

    Hi all,

    I have a problem displaying Khmer Unicode Character on QTextEdit. While other Khmer Unicode Character shown correctly in QTextEdit, this special case as shown in the figure below, did not show as expected. The same text in Ms Word show correctly what it is expected.

    I typed the text directly into QTextEdit field.



    Here is my code:

    Qt Code:
    1. #include <QApplication>
    2. #include <QTextEdit>
    3.  
    4. int main(int argc, char* argv[])
    5. {
    6. QApplication app(argc, argv);
    7. QTextEdit txt;
    8. QFont font;
    9. font.setPointSize(18);
    10. txt.setFont(font);
    11. txt.show();
    12.  
    13. return app.exec();
    14. }
    To copy to clipboard, switch view to plain text mode 

    Thanks for any kind reply.

  2. #2
    Join Date
    Apr 2010
    Location
    Sudan
    Posts
    46
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Khmer Unicode Problem with Qt 4.7/QTextEdit

    try to use this :

    Qt Code:
    1. #include <QTextCodec>
    2. QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    May 2011
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Khmer Unicode Problem with Qt 4.7/QTextEdit

    Thanks Tinysoft for your fast reply. I have change the code to sth like:

    Qt Code:
    1. QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
    2. QTextEdit txt;
    3. QFont font;
    4. font.setPointSize(18);
    5. txt.setFont(font);
    To copy to clipboard, switch view to plain text mode 

    But it still doesn't work.

  4. #4
    Join Date
    Apr 2010
    Location
    Sudan
    Posts
    46
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Khmer Unicode Problem with Qt 4.7/QTextEdit

    try to replace the "UTF-8" wih one of the other unicodes >> see here

    this link might help you to choose the correct Unicode.

    good luck !

  5. #5
    Join Date
    May 2011
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Khmer Unicode Problem with Qt 4.7/QTextEdit

    The correct codec for Khmer Unicode is UTF8. I just found that I have the same problem when typing the same text in Text Editor of Ubuntu. Perhap this is not QT problem.

    Anyway thanks for your suggestion.

Similar Threads

  1. Replies: 10
    Last Post: 17th July 2014, 10:52
  2. QString unicode problem
    By kemp in forum Qt Programming
    Replies: 6
    Last Post: 21st September 2010, 15:11
  3. QProcess and unicode problem
    By ramazangirgin in forum Qt Programming
    Replies: 0
    Last Post: 6th June 2008, 12:22
  4. i have a problem with Qt unicode
    By coder1985 in forum Qt Programming
    Replies: 5
    Last Post: 20th November 2007, 20:08
  5. Unicode problem in hoverlink
    By anju123 in forum Qt Programming
    Replies: 2
    Last Post: 27th August 2007, 13:56

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.