Skip to content

Commit

Permalink
Add note about Latin1StringView in UTF-8 source
Browse files Browse the repository at this point in the history
Pick-to: 6.7 6.8
Task-number: QTBUG-77020
Change-Id: I903917a000b21bc7502bf257f759bbfc71f10d45
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
  • Loading branch information
Matthias Rauter authored and marcmutz committed Oct 3, 2024
1 parent 755733f commit f4076f1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/corelib/text/qlatin1stringview.qdoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit f4076f1

Please sign in to comment.