OSDN Git Service

copy the result of nl_langinfo()
authorIvailo Monev <xakepa10@gmail.com>
Sat, 9 Jan 2021 00:17:21 +0000 (02:17 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Sat, 9 Jan 2021 00:17:21 +0000 (02:17 +0200)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/core/codecs/qtextcodec.cpp

index dd16d76..ac4cb8e 100644 (file)
@@ -190,8 +190,8 @@ static void setupLocaleMapper()
     }
 
     if (!localeMapper) {
-        const char *charset = ::nl_langinfo(CODESET);
-        if (charset)
+        const QByteArray charset = ::nl_langinfo(CODESET);
+        if (!charset.isEmpty())
             localeMapper = QTextCodec::codecForName(charset);
     }