[Development] Shall we turn on /utf-8 compiler option when build qt for Windows?

André Pönitz apoenitz at t-online.de
Sun Jan 29 10:33:39 CET 2017


On Sun, Jan 29, 2017 at 12:13:48PM +0800, Liang Jian wrote:
>     Start from qt-5.8 I can't build qt anymore under Windows(simplified
> chinese locale). Since there is a file
> src/plugins/generic/tuiotouch/qtuiohandler.cpp which contain non-latin-1
> character, msvc2015 assume the source code's character set should be CP936
> which make the complilation fail.
>     I can only build qt by comment the line which contain the specical
> character in src/plugins/generic/tuiotouch/qtuiohandler.cpp.
>     But if I turn on -developer-build in configuration step, thing will get
> worse than before, since -developer-build means treat warning as error, and
> again I can't build qt anymore since there are other files contain
> non-latin1 character (such as qstring.cpp), the build will fail due to the
> character set warning.
>     I am working on a Windows 10 x64 simplifed chinese machine, msvc2015
> update3
>     For more detail please refer to
> https://bugreports.qt.io/browse/QTBUG-58161
> 
>     As a workaround, I have to modify the file
> qtbase/mkspecs/common/msvc-desktop.conf
> QMAKE_CFLAGS            = -nologo -Zc:wchar_t /utf-8
>     After I add /utf-8 compiler option the build goes well.
>     Shall we turn on this compiler option by default?

We should remove non-ASCII characters from the sources if they cause problems.

If some non-ASCII is unproblematic (like the 'ä' in some copyright lines)
on all supported compilers, that's fine to have, but mining log messages
or comments with characters that are known to cause issues in the processing
are a mindless waste of resources.

Andre'




More information about the Development mailing list