- Qt 6.11
- Qt Core
- CMake Target Properties in Qt6 Core
- QT_NO_UTF8_SOURCE
- Qt 6.11.1 Reference Documentation

# QT_NO_UTF8_SOURCE

Prevents forcing source files to be treated as UTF-8 for Windows.

This property was introduced in Qt 6.0.

When building with some compilers for Windows, targets that link to a Qt library will use flags that force the compiler to treat its source files as UTF-8. This is currently implemented for Visual Studio and Intel compilers. You can disable this behavior on a per-target basis by setting the property to `TRUE`:

     set_property(TARGET target_name PROPERTY QT_NO_UTF8_SOURCE TRUE)

Note: This does not change the runtime behavior of classes like QString (its constructor from `const char *` requires properly encoded UTF-8 input). Use the QT_NO_CAST_FROM_ASCII and `QT_RESTRICTED_CAST_FROM_ASCII` macros to help identify such code.

See also qt_disable_unicode_defines() and qt6_allow_non_utf8_sources().