Results 1 to 3 of 3

Thread: Source files in UTF-8 and strange letters in program windows under Windows 7.

  1. #1
    Join Date
    Aug 2010
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Source files in UTF-8 and strange letters in program windows under Windows 7.

    I write my programs with UTF-8 file encoding. And in my programs (in their windows) I have wrong/strange letters instead my national characters.
    I checked my file encoding both in Qt Creator and in Notepad++ and in these editors national characters are properly displayed when file encoding is UTF-8. I checked strings in .exe files, and they are UTF-8 too.

    I also added to my .pro files line:
    CODECFORSRC = UTF-8
    And in main.cpp I added lines:
    QTextCodec::setCodecForTr(QTextCodec::codecForName ("UTF-8"));
    QTextCodec::setCodecForLocale(QTextCodec::codecFor Name("UTF-8"));
    QTextCodec::setCodecForCStrings(QTextCodec::codecF orName("UTF-8"));

    However I do not use tr() function and I supose that only last line should be suffice (but it is not).

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Source files in UTF-8 and strange letters in program windows under Windows 7.

    Please show us an example of your code using national characters.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2010
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Source files in UTF-8 and strange letters in program windows under Windows 7.

    I wrote simple app that shows this problem. I think this is due to global variables initialize before "main" execution.
    Attached Files Attached Files

Similar Threads

  1. Program runs on Windows 7, crashes on Windows XP
    By JovianGhost in forum General Programming
    Replies: 8
    Last Post: 7th June 2010, 01:55
  2. Absolute Path to users "Program Files" on Windows
    By MisterIKS in forum Qt Programming
    Replies: 6
    Last Post: 5th June 2010, 10:40
  3. Replies: 2
    Last Post: 20th February 2008, 21:48
  4. Open Source on Windows
    By yogeshgokul in forum Installation and Deployment
    Replies: 3
    Last Post: 29th January 2008, 10:54
  5. open source for windows
    By Reese in forum Installation and Deployment
    Replies: 5
    Last Post: 26th November 2007, 16:15

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.