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>
This commit is contained in:
Lars Knoll 2020-04-06 15:44:37 +02:00
parent 0b12b7f518
commit fd550c943f

View File

@ -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)