Document that to/FromLocal8Bit() does not consider CFStringGetSystemEncoding
The CFStringGetSystemEncoding() defaults to Mac Roman, unless overridden via ~/.CFUserTextEncoding, which very few users do or even know about. Make a note in the to/FromLocal8Bit() that we don't consult this function, or its NSString wrapper, when determining what the local 8 bit encoding is. Task-number: QTBUG-111443 Change-Id: I89b6040c62d42de0daea9df908d97d9a23e7b160 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
e7d038c027
commit
349bd4db22
@ -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
|
Returns the index position of the last occurrence of the \1 \a \2
|
||||||
in this string, searching backward from index position \a from.
|
in this string, searching backward from index position \a from.
|
||||||
//! [qstring-last-index-of]
|
//! [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]
|
||||||
|
@ -5457,8 +5457,7 @@ static QByteArray qt_convert_to_local_8bit(QStringView string);
|
|||||||
QByteArray. The returned byte array is undefined if the string
|
QByteArray. The returned byte array is undefined if the string
|
||||||
contains characters not supported by the local 8-bit encoding.
|
contains characters not supported by the local 8-bit encoding.
|
||||||
|
|
||||||
On Unix systems this is equivalent to toUtf8(), on Windows the systems
|
\include qstring.qdocinc {qstring-local-8-bit-equivalent} {toUtf8}
|
||||||
current code page is being used.
|
|
||||||
|
|
||||||
If this string contains any characters that cannot be encoded in the
|
If this string contains any characters that cannot be encoded in the
|
||||||
locale, the returned byte array is undefined. Those characters may be
|
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.
|
If \a size is \c{-1}, \c{strlen(str)} is used instead.
|
||||||
|
|
||||||
On Unix systems this is equivalent to fromUtf8(), on Windows the systems
|
\include qstring.qdocinc {qstring-local-8-bit-equivalent} {fromUtf8}
|
||||||
current code page is being used.
|
|
||||||
|
|
||||||
\sa toLocal8Bit(), fromLatin1(), 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.
|
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
|
\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
|
string, converted to Unicode null characters (U+0000). This behavior is
|
||||||
different from Qt 5.x.
|
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.
|
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
|
\note: any null ('\\0') bytes in the byte array will be included in this
|
||||||
string, converted to Unicode null characters (U+0000).
|
string, converted to Unicode null characters (U+0000).
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user