OSDN Git Service

make UTF-8 default codec for C-strings
authorIvailo Monev <xakepa10@laimg.moc>
Sun, 24 Nov 2019 16:52:01 +0000 (16:52 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Sun, 24 Nov 2019 16:52:01 +0000 (16:52 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
README
src/core/tools/qstring.cpp

diff --git a/README b/README
index 938f46a..0a4b6c7 100644 (file)
--- a/README
+++ b/README
@@ -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
index 8670dec..bf988bb 100644 (file)
 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