Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.2, 6.2.2, 6.8.0
-
None
Description
I have the class with Q_CLASSINFO with text in utf-8 encodings. Some of the characters are single-byte, and others are multi-bytes. MRE:
class Foo : public QObject { Q_OBJECT Q_CLASSINFO("foo", "1ффффффффффффффффффффффффффффффффффффффффффффффф"); ... }
When i try to compile this class, compiler says:
moc_foo.cpp:40:75: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
"1фффффффффффффффффффффффффффффффффф<D1>"
^~~~
This happens because the compiler split the two-byte utf-8 character and places bytes in different lines. Content of the moc_foo.cpp:
constexpr auto qt_meta_stringdata_CLASSFooENDCLASS = QtMocHelpers::stringData( "Foo", "foo", "1фффффффффффффффффффффффффффффффффф�" "�фффффффффффф" );
It would be correct to split strings on character boundaries rather than byte boundaries. Or not to split at all.