diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-04-06 15:44:37 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-04-16 23:15:10 +0200 |
commit | fd550c943ff5f5c744afee5125956e924dd9e027 (patch) | |
tree | cee215e319c1cf50b4b36d7482a772f16d0b2341 | |
parent | 0b12b7f5185839a3c1b0fccb10d66937ac884947 (diff) |
QString::from/toLocal8Bit: Assume locale is utf8 if we don't have codecs
If there is no text codec support, assume local8bit is utf8, not latin1.
This is in line with what 99% of all modern systems do.
Change-Id: I35ebcd43ef3572a25f549a8375857dcabcfec4ca
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/corelib/text/qstring.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 8e7e2e5dce..3f24665a8a 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -5204,7 +5204,7 @@ static QByteArray qt_convert_to_local_8bit(QStringView string) if (localeCodec) return localeCodec->fromUnicode(string); #endif // textcodec - return qt_convert_to_latin1(string); + return string.toUtf8(); } /*! @@ -5396,7 +5396,7 @@ QString QString::fromLocal8Bit_helper(const char *str, int size) if (codec) return codec->toUnicode(str, size); #endif // textcodec - return fromLatin1(str, size); + return fromUtf8(str, size); } /*! \fn QString QString::fromUtf8(const char *str, int size) |