From f4076f1058b97f92f65d668a274aa3bbd6d302f7 Mon Sep 17 00:00:00 2001 From: Matthias Rauter Date: Thu, 25 Jul 2024 12:09:57 +0200 Subject: [PATCH] Add note about Latin1StringView in UTF-8 source Pick-to: 6.7 6.8 Task-number: QTBUG-77020 Change-Id: I903917a000b21bc7502bf257f759bbfc71f10d45 Reviewed-by: Marc Mutz --- src/corelib/text/qlatin1stringview.qdoc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/corelib/text/qlatin1stringview.qdoc b/src/corelib/text/qlatin1stringview.qdoc index 60ac381c786..f331312a2b2 100644 --- a/src/corelib/text/qlatin1stringview.qdoc +++ b/src/corelib/text/qlatin1stringview.qdoc @@ -69,6 +69,13 @@ in the first place. In those cases, using QStringLiteral may be the better option. + \note Only US-ASCII literals can be used in QLatin1StringView if the source + code file is encoded in UTF-8, as \l{unicode}{Qt requires}. Non-US-ASCII + literals like \c{QLatin1StringView("é")} will not be represented correctly. + You can use octal or hex notation instead: + \c{QLatin1StringView("\351")} or \c{QLatin1StringView("\xe9")}, + respectively. + \sa QString, QLatin1Char, {QStringLiteral()}{QStringLiteral}, QT_NO_CAST_FROM_ASCII */