Results 1 to 6 of 6

Thread: Polish characters in editor

  1. #1
    Join Date
    May 2019
    Posts
    9
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Polish characters in editor

    Hello,

    I'm trying to put some text to QMessageBox:
    Qt Code:
    1. QMessageBox::warning(this,"B??d","Prosz? wybra? lub wpisa? numer");
    To copy to clipboard, switch view to plain text mode 

    after compiling i've got:
    1.png

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Polish characters in editor

    Is your source string correctly encoded in UTF-8?

    Check that you are not using a local encoding, like latin2 or some weird Windows codec.

    Cheers,
    _

  3. #3
    Join Date
    May 2019
    Posts
    9
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Polish characters in editor

    I've checked it before I wrote.

    I've UTF-8 in editor settings in QT Creator:
    qt1.png

    In editor there is correctly:
    qt2.png

    I've checked encoding by Notepad++:
    qt3.png


    I now I compiled and....still is wrong
    qt4.png

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Polish characters in editor

    Hmm, strange.

    Can you try
    Qt Code:
    1. const QString message = QString::fromUtf8(.....);
    2. qDebug() << message;
    3. QMessageBox::warning(this, message);
    To copy to clipboard, switch view to plain text mode 
    i.e. explicitly convert from UTF-8 and also writing it to the application output?

    Cheers,
    _

  5. The following user says thank you to anda_skoa for this useful post:

    mirek_zaklosa (12th June 2019)

  6. #5
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    461
    Thanked 64 Times in 60 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Polish characters in editor

    As always - the best way is to not anything else than ascii for strings in the source code and do a proper translation with linguist.

  7. The following user says thank you to ChristianEhrlicher for this useful post:

    mirek_zaklosa (12th June 2019)

  8. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,555
    Thanks
    13
    Thanked 1,581 Times in 1,510 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Polish characters in editor

    Regardless of what is in your source code, it seems that it is being inserted into the compiled binary encoded as Windows-1250 that is subsequently being interpreted as Windows-1252:
    Qt Code:
    1. // What should be there
    2. B &lstrok; &aogon; d &cacute;
    3. U+0042 U+0142 U+0105 U+0064 U+0107
    4. 0x42 0xC5 0x82 0xC4 0x85 0x64 0xC3 0xA6 encoded with UTF-8
    5.  
    6. // What seems to be there in the binary
    7. 0x42 0xB3 0xB9 0x64 0xE6 encoded with Windows-1250
    8. B ³ ¹ d æ if interpreted as Windows 1252
    To copy to clipboard, switch view to plain text mode 
    Last edited by ChrisW67; 10th June 2019 at 14:13. Reason: Forum mangles Polish chars :(

  9. The following user says thank you to ChrisW67 for this useful post:

    mirek_zaklosa (12th June 2019)

Similar Threads

  1. repeater polish() loop on ios
    By joko in forum Qt Quick
    Replies: 8
    Last Post: 13th March 2015, 16:35
  2. QTranslator and polish signs
    By damon_1990 in forum Newbie
    Replies: 0
    Last Post: 11th December 2011, 23:04
  3. Polish chars in the HTML generated by Qt.
    By Alan_K in forum Newbie
    Replies: 10
    Last Post: 21st March 2011, 10:29
  4. Qt for S60, problem with bold polish characters
    By Wiktor in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 26th August 2009, 10:37
  5. QDevelop needs Dutch and Polish translators
    By jlbrd in forum Qt-based Software
    Replies: 0
    Last Post: 4th December 2007, 18:54

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.