diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-04-17 14:29:46 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-05-14 07:46:45 +0200 |
commit | 94e210faeaf7ec6b8a41d7f707405d99be25e3f0 (patch) | |
tree | 8a461181c6e56a27b516e6c888e5b8ebf8b14228 /src/corelib/text/qstringconverter_p.h | |
parent | ea0a08c898fed9cfd8d8eb16613e352740d3eb02 (diff) |
Move local8bit conversion over to qutfsupport
Local8Bit is always UTF-8 except for Windows platforms.
Also add a Locale encoding to QStringConverter.
Change-Id: I8d729931fd4c1d7fc6857696b6442a44def3fd9d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qstringconverter_p.h')
-rw-r--r-- | src/corelib/text/qstringconverter_p.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/corelib/text/qstringconverter_p.h b/src/corelib/text/qstringconverter_p.h index 5764979542..763e3761d5 100644 --- a/src/corelib/text/qstringconverter_p.h +++ b/src/corelib/text/qstringconverter_p.h @@ -312,6 +312,19 @@ struct QUtf32 static QByteArray convertFromUnicode(const QChar *, qsizetype, QStringConverter::State *, DataEndianness = DetectEndianness); }; +struct QLocal8Bit +{ +#if !defined(Q_OS_WIN) || defined(QT_BOOTSTRAPPED) + static QString convertToUnicode(const char *chars, qsizetype len, QStringConverter::State *state) + { return QUtf8::convertToUnicode(chars, len, state); } + static QByteArray convertFromUnicode(const QChar *chars, qsizetype len, QStringConverter::State *state) + { return QUtf8::convertFromUnicode(chars, len, state); } +#else + static QString convertToUnicode(const char *, qsizetype, QStringConverter::State *); + static QByteArray convertFromUnicode(const QChar *, qsizetype, QStringConverter::State *); +#endif +}; + /* Converts from different utf encodings looking at a possible byte order mark at the beginning of the string. If no BOM exists, utf-8 is assumed. |