Doc: make a note about use of QStringLiteral with non-ASCII chars

Both ICC and MSVC have bugs concatenating strings and that's despite the
standard giving an example ([lex.string] table 9) that says that
  u"a" "b"
is the same as
  u"ab"

We can't change to preprocessor concatenation (u ## STR) because that
fails when QStringLiteral is used with a macro instead of an actual
string literal.

Task-number: QTBUG-65479
Change-Id: I39332e0a867442d58082fffd1504a0a868c291ef
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Thiago Macieira 2018-01-09 10:24:18 -08:00
parent 6d50f746fe
commit d80b0eb12c

View File

@ -10802,7 +10802,7 @@ QString QString::toHtmlEscaped() const
This cost can be avoided by using QStringLiteral instead:
\code
if (node.hasAttribute(QStringLiteral("http-contents-length"))) //...
if (node.hasAttribute(QStringLiteral(u"http-contents-length"))) //...
\endcode
In this case, QString's internal data will be generated at compile time; no
@ -10822,6 +10822,10 @@ QString QString::toHtmlEscaped() const
if (attribute.name() == QLatin1String("http-contents-length")) //...
\endcode
\note Some compilers have bugs encoding strings containing characters outside
the US-ASCII character set. Make sure you prefix your string with \c{u} in
those cases. It is optional otherwise.
\sa QByteArrayLiteral
*/