qt6-bb10/src
Thiago Macieira d4c7da9a07 CBOR: fix sorting of UTF16-to-UTF16 strings
This amends commit 394788c68e (its
ChangeLog applies to this commit too). That fixed sorting of UTF8-to-
UTF16, but when adding more unit tests, I've discovered that some UTF-16
strings also sorted incorrectly. There were two problems:

First, we were assuming that we could rely on the UTF-16 length as a
proxy for the UTF-8 one, but that's not true for some cases:
* both 1-, 2- and 3-codepoint UTF-8 sequences are 1 codepoint
  in UTF-16, so some strings would have identical UTF-16 length
* 4-codepoint UTF-8 sequences shrink to 2-codepoint UTF-16 ones
  (2:1) but 3-codepoint UTF-8 sequences shrink to 1 (3:1), so
  some strings would be longer in UTF-16 but shorter in UTF-8.

Second, QtPrivate::compareStrings performs UTF-16 codepoint comparisons
not Unicode character ones, so surrogate pairs were sorting before
U+E000 to U+FFFF.

To fix all of this, we need to decode the UTF-16 string into UTF-32 and
calculate the length of that in UTF-8 to be sure we have the sorting
order right.

Since this is a slight behavior change with a performance penalty, I am
choosing to backport only to 6.7. The penalty mostly does not apply to
6.8 due to commit 61556627f2.

Pick-to: 6.7
Change-Id: If1bf59ecbe014b569ba1fffd17c4c4ddcc874aac
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-04-12 21:41:16 -07:00
..
3rdparty CMake: Avoid dsmyutil warnings on shared libraries using libjpeg 2024-03-16 03:41:48 +01:00
android Android: fix 180 degree orientation issue 2024-04-12 02:20:51 +03:00
assets Introduce NO_GENERATE_CPP_EXPORTS argument for qt_internal_add_module 2024-02-09 23:00:04 +01:00
concurrent ResultReporter: fix uninitialized int member 2024-04-11 21:12:13 +02:00
corelib CBOR: fix sorting of UTF16-to-UTF16 strings 2024-04-12 21:41:16 -07:00
dbus QDBusObjectPath: Add QDebug stream operator 2024-03-01 22:57:13 +00:00
entrypoint src: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-10 23:36:51 +01:00
gui Add CMYK support to QColorSpace 2024-04-12 21:53:54 +02:00
network QHttp2Connection: fix handling of replies on locally initiated stream 2024-04-11 21:53:59 +02:00
opengl OpenGL: Add parameters to choose FBO grab orientation 2024-03-13 14:38:52 +00:00
openglwidgets Fix offscreen rendering in QOpenGLWidget 2024-03-07 16:10:02 +01:00
platformsupport libinput: Allow setting touchscreen matrix via env var 2024-04-09 21:10:47 +00:00
plugins WindowsIconEngine: Use the correct icon for document-properties 2024-04-12 19:55:30 +00:00
printsupport print: windows: Fix setting page orientation 2024-04-12 19:55:46 +00:00
sql SQL/ODBC: don't escape a driver string 2024-04-04 23:43:02 +02:00
testlib QBenchmark: abort if we can't open the output file 2024-04-04 12:24:18 +01:00
tools uic: use qOverload for ambiguous slots 2024-04-12 12:32:16 +00:00
widgets Implement QWindowContainer::minimumSizeHint() 2024-04-12 17:12:18 +00:00
xml Extract method `bool QDomNodeListPrivate::maybeCreateList()` 2024-03-20 14:21:00 +00:00
CMakeLists.txt Add Qt icon library for examples 2023-04-22 18:14:38 +03:00