Results 1 to 7 of 7

Thread: UTF-8 Issues in Sample

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default UTF-8 Issues in Sample

    Hi everyone,

    I'm new to QT and am running into problems displaying UTF8 data. If anyone with more experience with the library has any thoughts I'd be very grateful to hear them. The code base in question is the "previewer" program in the /examples/webkit/previewer subdirectory. I am trying to get a QString containing Chinese characters to show up in the "HTML Preview" box.

    I've spent about three to four hours trying to debug the problem. I can confirm that everything from fonts to system-variables are set up properly. I can also confirm that the QString contains data which was successfully read in from a std::string containing UTF-8 data. I know this because the text is not garbled when printed to the command-line terminal. Nor is it garbled when it is displayed in the "HTML Editing" box. It is only getting garbled when it is displayed in the "HTML Preview" box.

    The code that handles HTML processing seems capable of displaying Chinese content though. When I request a random webpage with Chinese characters, I can see that Chinese characters fetched from remote sites work perfectly fine. The following code works fine, for instance:

    // webView->setHtml(text); // text is a QString containing Chinese characters
    webView->load(tr("http://www.popupchinese.com"));

    The problem seems to be with passing a QString through the webView->setHTML function. As a newcomer to QT, I'm somewhat baffled by this, and would love to hear any thoughts or suggestions someone with more experience might have at this point. I'm not sure if this is a bug with the software, or if there is something related to the way the Webkit works that I'm simply missing. The online documentation has not been much help, although I've mostly been googling things and working through the class reference, so suggestions on additional resources would be much appreciated.
    Last edited by trevelyan; 14th November 2008 at 22:20.

Similar Threads

  1. how to write a sample application using QT on windows mobile
    By pallavi Boyapat in forum Qt Programming
    Replies: 0
    Last Post: 4th November 2008, 06:10
  2. how to write hello world sample QT application on windows mobile
    By pallavi Boyapat in forum Qt Programming
    Replies: 8
    Last Post: 3rd November 2008, 12:06
  3. Any issues with Qt 4.3.x and Mac Xcode 3.0?
    By will49 in forum Qt Programming
    Replies: 0
    Last Post: 7th March 2008, 16:30
  4. Issues updating to QMdiArea
    By fnmblot in forum Qt Programming
    Replies: 9
    Last Post: 17th December 2007, 18:37
  5. MySql plugin driver issues
    By stevey in forum Installation and Deployment
    Replies: 11
    Last Post: 20th September 2006, 13:45

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.