make UTF-8 default codec for C-strings

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2019-11-24 16:52:01 +00:00
parent f0bef9de3e
commit 6867c6f316
2 changed files with 5 additions and 6 deletions

2
README
View file

@ -69,7 +69,7 @@ QTBUG-40153, QTBUG-35479, QTBUG-1628, QTBUG-42989, QTBUG-34861, QTBUG-46767,
QTBUG-25114, QTBUG-24672, QTBUG-23524 (WIP), QTBUG-56088, QTBUG-42189,
QTBUG-39285, QTBUG-18173, QTBUG-28968, QTBUG-34336, QTBUG-40974, QTBUG-44286,
QTBUG-12564, QTBUG-20028, QTBUG-71967, QTBUG-70956, QTBUG-71446, QTBUG-61307,
QTBUG-27287, QTBUG-25143, QTBUG-22833, QTBUG-57399
QTBUG-27287, QTBUG-25143, QTBUG-22833, QTBUG-57399, QTBUG-59159
Unless you use QMake and QDoc porting to Katie or even supporting it along with
Qt4 in the same codebase is trivial and requires only minor changes because

View file

@ -62,10 +62,9 @@
QT_BEGIN_NAMESPACE
#ifndef QT_NO_TEXTCODEC
QTextCodec *QString::codecForCStrings;
QTextCodec *QString::codecForCStrings = QTextCodec::codecForName("UTF-8");
#endif
#ifdef QT_STD_LOCALE
// qlocale_std.cpp
extern bool qt_ucol_strcoll(const QChar *source, int sourceLength, const QChar *target, int targetLength, int *result);
@ -372,8 +371,8 @@ static int findChar(const QChar *str, int len, QChar ch, int from,
QString converts the \c{const char *} data into Unicode using the
fromAscii() function. By default, fromAscii() treats character
above 128 as Latin-1 characters, but this can be changed by
calling QTextCodec::setCodecForCStrings().
characters as UTF-8, but this can be changed by calling
QTextCodec::setCodecForCStrings().
In all of the QString functions that take \c{const char *}
parameters, the \c{const char *} is interpreted as a classic
@ -513,7 +512,7 @@ static int findChar(const QChar *str, int len, QChar ch, int from,
\list
\o toAscii() returns an 8-bit string encoded using the codec
specified by QTextCodec::codecForCStrings (by default, that is
Latin 1).
UTF-8).
\o toLatin1() returns a Latin-1 (ISO 8859-1) encoded 8-bit string.
\o toUtf8() returns a UTF-8 encoded 8-bit string. UTF-8 is a
superset of US-ASCII (ANSI X3.4-1986) that supports the entire