diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-05-07 16:32:18 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-05-14 19:14:51 +0200 |
commit | b4fd377aa984defea63ecb8951c152872202146e (patch) | |
tree | 18aa45156dce81faf4aebb83a36a58ec5198f763 /tests/auto/other | |
parent | 9e1dc1e8a9fda1a7576cc6377c8a36decff631eb (diff) |
Make utf8_source the default for qmake builds
We now assume that source code is encoded in UTF-8 by default on
all platforms (and verify this with an auto test). Provide
a CONFIG+=no_utf8_source option for backwards compatibility.
[ChangeLog][qmake] qmake will tell the compiler that source code is
encoded in utf-8 by default. This mainly has an effect on Windows, where
MSVC still assumes source code is encoded in the current ANSI code page.
Use CONFIG+=no_utf8_source to get back the Qt 5 behavior.
Change-Id: I6dcafcaeefdea7d3907ccb723aeb7d23ccc0f04f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/other')
-rw-r--r-- | tests/auto/other/compiler/tst_compiler.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp index 78026665be..4d19debd06 100644 --- a/tests/auto/other/compiler/tst_compiler.cpp +++ b/tests/auto/other/compiler/tst_compiler.cpp @@ -115,6 +115,9 @@ private slots: /* Future / Technical specification compiler features */ void runtimeArrays(); + + /* treat source code as utf-8 */ + void utf8source(); }; #if defined(Q_CC_HPACC) @@ -1551,5 +1554,18 @@ void tst_Compiler::runtimeArrays() #endif } + + +void tst_Compiler::utf8source() +{ + const char *str = "Ελληνικά"; + auto u16str = u"Ελληνικά"; + QCOMPARE(QString::fromUtf16(u16str), QString::fromUtf8(str)); + + const char *ae = "\xc3\x86"; + auto u16ae = u"Æ"; + QCOMPARE(QString::fromUtf16(u16ae), QString::fromUtf8(ae)); +} + QTEST_MAIN(tst_Compiler) #include "tst_compiler.moc" |