From 5ca4c8c528193f27092d70c60985461f6d91e6fb Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sat, 14 Jun 2025 15:24:28 -0700 Subject: [PATCH] [gnc-unicode] Use unicode_compare_internal for gnc_unicode_compare_identical instead of strcmp. strcmp does a byte-by-byte numerical comparison, not an alphabetical one (e.g. A > e). Also fix the transposed args in the strstr call in gnc_unicode_has_substring_identical. --- libgnucash/core-utils/gnc-unicode.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libgnucash/core-utils/gnc-unicode.cpp b/libgnucash/core-utils/gnc-unicode.cpp index 55ed179506..6a44df33da 100644 --- a/libgnucash/core-utils/gnc-unicode.cpp +++ b/libgnucash/core-utils/gnc-unicode.cpp @@ -151,7 +151,7 @@ gnc_unicode_has_substring_identical(const char* needle, int* position, int* length) { - auto location = strstr(needle, haystack); + auto location = strstr(haystack, needle); if (location && location != haystack) { *position = static_cast(location - haystack); @@ -218,5 +218,6 @@ gnc_unicode_compare_accented_case_sensitive(const char* one, const char* two) int gnc_unicode_compare_identical(const char* one, const char* two) { - return strcmp(one, two); + return unicode_compare_internal(one, two, CompareStrength::IDENTICAL); + }