Warning, /graphics/krita/3rdparty/ext_qt/0130-Support-UTF-8-code-page-directly-in-QTextCodec.patch is written in an unsupported language. File is not indexed.

0001 From d5c2a9154ffb0bdb37ce027b7acc3bd139544587 Mon Sep 17 00:00:00 2001
0002 From: Alvin Wong <alvinhochun@gmail.com>
0003 Date: Thu, 19 May 2022 18:39:11 +0800
0004 Subject: [PATCH] Support UTF-8 code page directly in QTextCodec
0005 
0006 If `GetACP() == CP_UTF8` then just use Qt's internal UTF-8 codec, which
0007 does not have bugs and will be much faster than MultiByteToWideChar.
0008 
0009 Ref: https://lists.qt-project.org/pipermail/interest/2022-May/038245.html
0010 ---
0011  src/corelib/codecs/qtextcodec.cpp | 14 ++++++++++++--
0012  1 file changed, 12 insertions(+), 2 deletions(-)
0013 
0014 diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
0015 index eb05446beb..76937ff170 100644
0016 --- a/src/corelib/codecs/qtextcodec.cpp
0017 +++ b/src/corelib/codecs/qtextcodec.cpp
0018 @@ -86,6 +86,10 @@
0019  #endif // icu
0020  #endif // QT_BOOTSTRAPPED
0021  
0022 +#ifdef Q_OS_WIN
0023 +#  include <qt_windows.h>
0024 +#endif
0025 +
0026  #include "qmutex.h"
0027  
0028  #include <stdlib.h>
0029 @@ -174,7 +178,11 @@ static QTextCodec *setupLocaleMapper()
0030  #if defined(QT_LOCALE_IS_UTF8)
0031      locale = QTextCodec::codecForName("UTF-8");
0032  #elif defined(Q_OS_WIN)
0033 -    locale = QTextCodec::codecForName("System");
0034 +    if (GetACP() == CP_UTF8) {
0035 +        locale = QTextCodec::codecForName("UTF-8");
0036 +    } else {
0037 +        locale = QTextCodec::codecForName("System");
0038 +    }
0039  #else
0040  
0041      // First try getting the codecs name from nl_langinfo and see
0042 @@ -294,7 +302,9 @@ static void setup()
0043      (void) new QIconvCodec;
0044  #endif
0045  #if defined(Q_OS_WIN32)
0046 -    (void) new QWindowsLocalCodec;
0047 +    if (GetACP() != CP_UTF8) {
0048 +        (void) new QWindowsLocalCodec;
0049 +    }
0050  #endif // Q_OS_WIN32
0051  #endif // codecs && !QT_BOOTSTRAPPED
0052  
0053 -- 
0054 2.24.1.windows.2
0055