From fd550c943ff5f5c744afee5125956e924dd9e027 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 6 Apr 2020 15:44:37 +0200 Subject: 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 --- src/corelib/text/qstring.cpp | 4 ++-- 1 file 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) -- cgit v1.2.3