BOM and QtCreator, bug or not?
-
I use "QtScriptExtentions":http://doc.trolltech.com/4.7/qtscriptextensions.html in my application. And have problem:
If in init.js of my extension I write russian text (UTF-8 encoding) then in application I see strange symbols instead of russian letters.
This problem is only Windows system (not Linux).I add "BOM charachers":http://en.wikipedia.org/wiki/Byte_order_mark in my init.js with Hex editor help and problem disappear.
But If I edit this file in Qt Creator again, BOM deleting.How you think, it's Qt Creator bug or not?
-
Which encoding is Qt Creator using? It defaults to whichever encoding the system is using and unfortunately Windows is still defaulting to codepages:-(
-
Tobias, files editing is done in Linux (utf-8) and at Linux it works ok, but when you try to compile and run it at Windows wrong encoding is used. BOM helps with this problem, but QtCreator loses BOM if you try to edit file again (at Linux or Windows).
-
This is true, when i deploy a multilanguage program to linux and windows i become crazy for this :)
Sometimes qtcreator say me that the file is locked and for editing i have to change the encode language.[quote author="Denis Kormalev" date="1292317409"]Tobias, files editing is done in Linux (utf-8) and at Linux it works ok, but when you try to compile and run it at Windows wrong encoding is used. BOM helps with this problem, but QtCreator loses BOM if you try to edit file again (at Linux or Windows).[/quote]
-
We changed file encodings on all our development environment on all platforms to UTF-8 (Visual Studio and Qt Creator default settings - no more relying on the system default locale, all source files, etc.) and are happy without any problems. With that setup, no BOM are necessary for guessing the right encoding.
For the C++ files there are some settings in the .pro file and the main function necessary, but that's not a big deal and is well documented.
-
Denis: All this wold go away if microsoft would finally switch to unicode based encoding schemes by default. Mac and Linux are doing that for ages now and Windows does support it too (unicode is in there since Win 95 IIRC), it is just that they have not yet switched the default.
A issue regarding BOM handling was recently fixed in the master branch of creator ("QTCREATORBUG-1857":http://bugreports.qt.nokia.com/browse/QTCREATORBUG-1857), maybe that fixes your BOM issue, too?