summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/doc/src/includes/qstring.qdocinc12
-rw-r--r--src/corelib/text/qstring.cpp10
2 files changed, 18 insertions, 4 deletions
diff --git a/src/corelib/doc/src/includes/qstring.qdocinc b/src/corelib/doc/src/includes/qstring.qdocinc
index a3c8810a8b..dade4f0af0 100644
--- a/src/corelib/doc/src/includes/qstring.qdocinc
+++ b/src/corelib/doc/src/includes/qstring.qdocinc
@@ -22,3 +22,15 @@ Returns -1 if \a \2 is not found.
Returns the index position of the last occurrence of the \1 \a \2
in this string, searching backward from index position \a from.
//! [qstring-last-index-of]
+
+//! [qstring-local-8-bit-equivalent]
+On Unix systems this is equivalent to \1().
+Note that on Apple systems this function does not take
+\c\l{https://developer.apple.com/documentation/foundation/nsstring/1410091-defaultcstringencoding?language=objc}
+{NSString.defaultCStringEncoding} or
+\c\l{https://developer.apple.com/documentation/corefoundation/1541720-cfstringgetsystemencoding?language=objc}
+{CFStringGetSystemEncoding()} into account, as these functions
+typically return the legacy "Western (Mac OS Roman)" encoding,
+which should not be used on modern Apple operating systems.
+On Windows the system's current code page is used.
+//! [qstring-local-8-bit-equivalent]
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index 2d9840fb5d..248d9e7b8e 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -5457,8 +5457,7 @@ static QByteArray qt_convert_to_local_8bit(QStringView string);
QByteArray. The returned byte array is undefined if the string
contains characters not supported by the local 8-bit encoding.
- On Unix systems this is equivalent to toUtf8(), on Windows the systems
- current code page is being used.
+ \include qstring.qdocinc {qstring-local-8-bit-equivalent} {toUtf8}
If this string contains any characters that cannot be encoded in the
locale, the returned byte array is undefined. Those characters may be
@@ -5655,8 +5654,7 @@ QString QString::fromLatin1(QByteArrayView ba)
If \a size is \c{-1}, \c{strlen(str)} is used instead.
- On Unix systems this is equivalent to fromUtf8(), on Windows the systems
- current code page is being used.
+ \include qstring.qdocinc {qstring-local-8-bit-equivalent} {fromUtf8}
\sa toLocal8Bit(), fromLatin1(), fromUtf8()
*/
@@ -5668,6 +5666,8 @@ QString QString::fromLatin1(QByteArrayView ba)
Returns a QString initialized with the 8-bit string \a str.
+ \include qstring.qdocinc {qstring-local-8-bit-equivalent} {fromUtf8}
+
\note: any null ('\\0') bytes in the byte array will be included in this
string, converted to Unicode null characters (U+0000). This behavior is
different from Qt 5.x.
@@ -5680,6 +5680,8 @@ QString QString::fromLatin1(QByteArrayView ba)
Returns a QString initialized with the 8-bit string \a str.
+ \include qstring.qdocinc {qstring-local-8-bit-equivalent} {fromUtf8}
+
\note: any null ('\\0') bytes in the byte array will be included in this
string, converted to Unicode null characters (U+0000).
*/