summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.adoc1
-rw-r--r--doc/en/weechat_plugin_api.en.adoc86
-rw-r--r--doc/fr/weechat_plugin_api.fr.adoc94
-rw-r--r--doc/it/weechat_plugin_api.it.adoc100
-rw-r--r--doc/ja/weechat_plugin_api.ja.adoc98
-rw-r--r--doc/sr/weechat_plugin_api.sr.adoc94
-rw-r--r--src/core/wee-config.c6
-rw-r--r--src/core/wee-string.c90
-rw-r--r--src/core/wee-utf8.c79
-rw-r--r--src/core/wee-utf8.h1
-rw-r--r--tests/unit/core/test-core-eval.cpp4
-rw-r--r--tests/unit/core/test-core-string.cpp10
-rw-r--r--tests/unit/core/test-core-utf8.cpp9
13 files changed, 456 insertions, 216 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 3b36e4b39..a4f33d3f8 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -20,6 +20,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
New features::
+ * core: improve case convert and insensitive char comparisons (issue #258)
* core: add color attributes "blink" and "dim" (half bright) (issue #1855)
* core: allow command `/toggle` to create option before setting the value, if allowed in the section (issue #1837)
* core: add signals "buffer_user_input_xxx" and "buffer_user_closing_xxx" for buffers created with `/buffer add` (issue #1848)
diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc
index e8619b081..991d0d997 100644
--- a/doc/en/weechat_plugin_api.en.adoc
+++ b/doc/en/weechat_plugin_api.en.adoc
@@ -618,9 +618,13 @@ This function is not available in scripting API.
_Updated in 3.8._
-Return a string with uppercase letters converted to lowercase. +
-This function is locale independent: only letters `A` to `Z` without accents
-are converted to lowercase. All other chars are kept as-is.
+Return a string with uppercase letters converted to lowercase.
+
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`. +
+Moreover, a newly allocated string is returned and must be freed after use.
Prototype:
@@ -641,7 +645,7 @@ C example:
[source,c]
----
-char *str = weechat_string_tolower ("ABCD_É"); /* result: "abcd_É" */
+char *str = weechat_string_tolower ("ABCD_É"); /* result: "abcd_é" */
/* ... */
free (str);
----
@@ -653,9 +657,13 @@ This function is not available in scripting API.
_Updated in 3.8._
-Return a string with lowercase letters converted to uppercase. +
-This function is locale independent: only letters `a` to `z` without accents
-are converted to uppercase. All other chars are kept as-is.
+Return a string with lowercase letters converted to uppercase.
+
+[NOTE]
+Behavior has changed in version 3.8: now all lowercase letters are properly
+converted to uppercase (by calling function `towupper`), in addition to the
+range `a` to `z`. +
+Moreover, a newly allocated string is returned and must be freed after use.
Prototype:
@@ -676,7 +684,7 @@ C example:
[source,c]
----
-char *str = weechat_string_toupper ("abcd_é"); /* result: "ABCD_é" */
+char *str = weechat_string_toupper ("abcd_é"); /* result: "ABCD_É" */
/* ... */
free (str);
----
@@ -686,9 +694,14 @@ This function is not available in scripting API.
==== strcasecmp
-_Updated in 1.0._
+_Updated in 1.0, 3.8._
+
+Case insensitive string comparison.
-Locale and case independent string comparison.
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
Prototype:
@@ -712,7 +725,9 @@ C example:
[source,c]
----
-int diff = weechat_strcasecmp ("aaa", "CCC"); /* == -2 */
+int diff;
+diff = weechat_strcasecmp ("aaa", "CCC"); /* == -1 */
+diff = weechat_strcasecmp ("noël", "NOËL"); /* == 0 */
----
[NOTE]
@@ -762,9 +777,14 @@ This function is not available in scripting API.
==== strncasecmp
-_Updated in 1.0._
+_Updated in 1.0, 3.8._
+
+Case insensitive string comparison, for _max_ chars.
-Locale and case independent string comparison, for _max_ chars.
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
Prototype:
@@ -840,10 +860,9 @@ This function is not available in scripting API.
==== strcmp_ignore_chars
-_Updated in 1.0._
+_Updated in 1.0, 3.8._
-Locale (and optionally case independent) string comparison, ignoring some
-chars.
+String comparison ignoring some chars.
Prototype:
@@ -861,6 +880,11 @@ Arguments:
* _chars_ignored_: string with chars to ignored
* _case_sensitive_: 1 for case sensitive comparison, otherwise 0
+[NOTE]
+Behavior has changed in version 3.8 when _case_sensitive_ is set to 0: now all
+uppercase letters are properly converted to lowercase (by calling function
+`towlower`), in addition to the range `A` to `Z`.
+
Return value:
* -1 if string1 < string2
@@ -879,9 +903,14 @@ This function is not available in scripting API.
==== strcasestr
-_Updated in 1.3._
+_Updated in 1.3, 3.8._
+
+Case insensitive string search.
-Locale and case independent string search.
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
Prototype:
@@ -954,7 +983,7 @@ length = weechat.strlen_screen("é") # 1
==== string_match
-_Updated in 1.0._
+_Updated in 1.0, 3.8._
Check if a string matches a mask.
@@ -977,6 +1006,11 @@ Arguments:
Since version 1.0, wildcards are allowed inside the mask
(not only beginning/end of mask).
+[NOTE]
+Behavior has changed in version 3.8 when _case_sensitive_ is set to 0: now all
+uppercase letters are properly converted to lowercase (by calling function
+`towlower`), in addition to the range `A` to `Z`.
+
Return value:
* 1 if string matches mask, otherwise 0
@@ -1009,7 +1043,7 @@ match5 = weechat.string_match("abcdef", "*b*d*", 0) # == 1
==== string_match_list
-_WeeChat ≥ 2.5._
+_WeeChat ≥ 2.5, updated in 3.8._
Check if a string matches a list of masks where negative mask is allowed
with the format "!word". A negative mask has higher priority than a standard
@@ -1030,6 +1064,11 @@ Arguments:
is compared to the string with the function <<_string_match,string_match>>
* _case_sensitive_: 1 for case sensitive comparison, otherwise 0
+[NOTE]
+Behavior has changed in version 3.8 when _case_sensitive_ is set to 0: now all
+uppercase letters are properly converted to lowercase (by calling function
+`towlower`), in addition to the range `A` to `Z`.
+
Return value:
* 1 if string matches list of masks (at least one mask matches and no negative
@@ -3624,10 +3663,15 @@ This function is not available in scripting API.
==== utf8_charcasecmp
-_Updated in 1.0._
+_Updated in 1.0, 3.8._
Compare two UTF-8 chars, ignoring case.
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
+
Prototype:
[source,c]
diff --git a/doc/fr/weechat_plugin_api.fr.adoc b/doc/fr/weechat_plugin_api.fr.adoc
index bac367bed..ca52b4977 100644
--- a/doc/fr/weechat_plugin_api.fr.adoc
+++ b/doc/fr/weechat_plugin_api.fr.adoc
@@ -628,10 +628,14 @@ Cette fonction n'est pas disponible dans l'API script.
_Mis à jour dans la 3.8._
-Retourner une chaîne avec les lettres majuscules converties en minuscules. +
-Cette fonction n'est pas dépendante de la locale : seules les lettres `A` à `Z`
-sans accents sont converties en minuscules. Tous les autres caractères sont
-gardés tels quels.
+Retourner une chaîne avec les lettres majuscules converties en minuscules.
+
+[NOTE]
+Le comportement a changé dans la version 3.8 : désormais toutes les lettres en
+majuscules sont correctement converties en minuscules (par appel à la fonction
+`towlower`), en plus de l'intervalle de `A` à `Z`. +
+De plus, une chaîne nouvellement allouée est retournée et doit être libérée après
+utilisation.
Prototype :
@@ -653,7 +657,7 @@ Exemple en C :
[source,c]
----
-char *str = weechat_string_tolower ("ABCD_É"); /* résultat : "abcd_É" */
+char *str = weechat_string_tolower ("ABCD_É"); /* résultat : "abcd_é" */
/* ... */
free (str);
----
@@ -665,10 +669,14 @@ Cette fonction n'est pas disponible dans l'API script.
_Mis à jour dans la 3.8._
-Retourner une chaîne avec les lettres minuscules converties en majuscules. +
-Cette fonction n'est pas dépendante de la locale : seules les lettres `a` à `z`
-sans accents sont converties en majuscules. Tous les autres caractères sont
-gardés tels quels.
+Retourner une chaîne avec les lettres minuscules converties en majuscules.
+
+[NOTE]
+Le comportement a changé dans la version 3.8 : désormais toutes les lettres en
+minuscules sont correctement converties en majuscules (par appel à la fonction
+`towupper`), en plus de l'intervalle de `a` à `z`. +
+De plus, une chaîne nouvellement allouée est retournée et doit être libérée après
+utilisation.
Prototype :
@@ -690,7 +698,7 @@ Exemple en C :
[source,c]
----
-char *str = weechat_string_toupper ("abcd_é"); /* résultat : "ABCD_é" */
+char *str = weechat_string_toupper ("abcd_é"); /* résultat : "ABCD_É" */
/* ... */
free (str);
----
@@ -700,9 +708,14 @@ Cette fonction n'est pas disponible dans l'API script.
==== strcasecmp
-_Mis à jour dans la 1.0._
+_Mis à jour dans la 1.0, 3.8._
+
+Comparer deux chaînes indépendemment de la casse.
-Comparer deux chaînes indépendemment de la locale et de la casse.
+[NOTE]
+Le comportement a changé dans la version 3.8 : désormais toutes les lettres en
+majuscules sont correctement converties en minuscules (par appel à la fonction
+`towlower`), en plus de l'intervalle de `A` à `Z`.
Prototype :
@@ -726,7 +739,9 @@ Exemple en C :
[source,c]
----
-int diff = weechat_strcasecmp ("aaa", "CCC"); /* == -2 */
+int diff;
+diff = weechat_strcasecmp ("aaa", "CCC"); /* == -1 */
+diff = weechat_strcasecmp ("noël", "NOËL"); /* == 0 */
----
[NOTE]
@@ -776,10 +791,14 @@ Cette fonction n'est pas disponible dans l'API script.
==== strncasecmp
-_Mis à jour dans la 1.0._
+_Mis à jour dans la 1.0, 3.8._
-Comparer deux chaînes indépendemment de la locale et de la casse, pour _max_
-caractères.
+Comparer deux chaînes indépendemment de la casse, pour _max_ caractères.
+
+[NOTE]
+Le comportement a changé dans la version 3.8 : désormais toutes les lettres en
+majuscules sont correctement converties en minuscules (par appel à la fonction
+`towlower`), en plus de l'intervalle de `A` à `Z`.
Prototype :
@@ -855,10 +874,9 @@ Cette fonction n'est pas disponible dans l'API script.
==== strcmp_ignore_chars
-_Mis à jour dans la 1.0._
+_Mis à jour dans la 1.0, 3.8._
-Comparer deux chaînes indépendemment de la locale (et en option de la casse), en
-ignorant des caractères.
+Comparer deux chaînes en ignorant des caractères.
Prototype :
@@ -876,6 +894,12 @@ Paramètres :
* _chars_ignored_ : chaîne avec les caractères à ignorer
* _case_sensitive_ : 1 pour une comparaison tenant compte de la casse, sinon 0
+[NOTE]
+Le comportement a changé dans la version 3.8 lorsque _case_sensitive_ est
+positionné à 0 : désormais toutes les lettres en majuscules sont correctement
+converties en minuscules (par appel à la fonction `towlower`), en plus de
+l'intervalle de `A` à `Z`.
+
Valeur de retour :
* -1 si string1 < string2
@@ -894,9 +918,14 @@ Cette fonction n'est pas disponible dans l'API script.
==== strcasestr
-_Mis à jour dans la 1.3._
+_Mis à jour dans la 1.3, 3.8._
-Rechercher une chaîne indépendemment de la locale et de la casse.
+Rechercher une chaîne indépendemment de la casse.
+
+[NOTE]
+Le comportement a changé dans la version 3.8 : désormais toutes les lettres en
+majuscules sont correctement converties en minuscules (par appel à la fonction
+`towlower`), en plus de l'intervalle de `A` à `Z`.
Prototype :
@@ -971,7 +1000,7 @@ length = weechat.strlen_screen("é") # 1
==== string_match
-_Mis à jour dans la 1.0._
+_Mis à jour dans la 1.0, 3.8._
Vérifier si une chaîne correspond à un masque.
@@ -994,6 +1023,12 @@ Paramètres :
Depuis la version 1.0, les caractères joker sont autorisés à l'intérieur du
masque (pas seulement au début et à la fin du masque).
+[NOTE]
+Le comportement a changé dans la version 3.8 lorsque _case_sensitive_ est
+positionné à 0 : désormais toutes les lettres en majuscules sont correctement
+converties en minuscules (par appel à la fonction `towlower`), en plus de
+l'intervalle de `A` à `Z`.
+
Valeur de retour :
* 1 si la chaîne correspond au masque, sinon 0
@@ -1026,7 +1061,7 @@ match5 = weechat.string_match("abcdef", "*b*d*", 0) # == 1
==== string_match_list
-_WeeChat ≥ 2.5._
+_WeeChat ≥ 2.5, mis à jour dans la 3.8._
Vérifier si une chaîne correspond à une liste de masques. Des masques négatifs
sont autorisés avec le format "!mot". Un masque négatif a une priorité plus
@@ -1048,6 +1083,12 @@ Paramètres :
<<_string_match,string_match>>
* _case_sensitive_ : 1 pour une comparaison tenant compte de la casse, sinon 0
+[NOTE]
+Le comportement a changé dans la version 3.8 lorsque _case_sensitive_ est
+positionné à 0 : désormais toutes les lettres en majuscules sont correctement
+converties en minuscules (par appel à la fonction `towlower`), en plus de
+l'intervalle de `A` à `Z`.
+
Valeur de retour :
* 1 si la chaîne correspond à la liste de masques (au moins un masque correspond
@@ -3687,10 +3728,15 @@ Cette fonction n'est pas disponible dans l'API script.
==== utf8_charcasecmp
-_Mis à jour dans la 1.0._
+_Mis à jour dans la 1.0, 3.8._
Comparer deux caractères UTF-8 en ignorant la casse.
+[NOTE]
+Le comportement a changé dans la version 3.8 : désormais toutes les lettres en
+majuscules sont correctement converties en minuscules (par appel à la fonction
+`towlower`), en plus de l'intervalle de `A` à `Z`.
+
Prototype :
[source,c]
diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc
index 01604d555..8b226a562 100644
--- a/doc/it/weechat_plugin_api.it.adoc
+++ b/doc/it/weechat_plugin_api.it.adoc
@@ -656,9 +656,13 @@ Questa funzione non è disponibile nelle API per lo scripting.
_Updated in 3.8._
// TRANSLATION MISSING
-Return a string with uppercase letters converted to lowercase. +
-This function is locale independent: only letters `A` to `Z` without accents
-are converted to lowercase. All other chars are kept as-is.
+Return a string with uppercase letters converted to lowercase.
+
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`. +
+Moreover, a newly allocated string is returned and must be freed after use.
Prototipo:
@@ -680,7 +684,7 @@ Esempio in C:
[source,c]
----
-char *str = weechat_string_tolower ("ABCD_É"); /* result: "abcd_É" */
+char *str = weechat_string_tolower ("ABCD_É"); /* result: "abcd_é" */
/* ... */
free (str);
----
@@ -694,9 +698,13 @@ Questa funzione non è disponibile nelle API per lo scripting.
_Updated in 3.8._
// TRANSLATION MISSING
-Return a string with lowercase letters converted to uppercase. +
-This function is locale independent: only letters `a` to `z` without accents
-are converted to uppercase. All other chars are kept as-is.
+Return a string with lowercase letters converted to uppercase.
+
+[NOTE]
+Behavior has changed in version 3.8: now all lowercase letters are properly
+converted to uppercase (by calling function `towupper`), in addition to the
+range `a` to `z`. +
+Moreover, a newly allocated string is returned and must be freed after use.
Prototipo:
@@ -718,7 +726,7 @@ Esempio in C:
[source,c]
----
-char *str = weechat_string_toupper ("abcd_é"); /* result: "ABCD_é" */
+char *str = weechat_string_toupper ("abcd_é"); /* result: "ABCD_É" */
/* ... */
free (str);
----
@@ -729,9 +737,16 @@ Questa funzione non è disponibile nelle API per lo scripting.
==== strcasecmp
// TRANSLATION MISSING
-_Updated in 1.0._
+_Updated in 1.0, 3.8._
-Confronta stringa non sensibile alle maiuscole e alla localizzazione.
+// TRANSLATION MISSING
+Case insensitive string comparison.
+
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
Prototipo:
@@ -755,7 +770,9 @@ Esempio in C:
[source,c]
----
-int diff = weechat_strcasecmp ("aaa", "CCC"); /* == -2 */
+int diff;
+diff = weechat_strcasecmp ("aaa", "CCC"); /* == -1 */
+diff = weechat_strcasecmp ("noël", "NOËL"); /* == 0 */
----
[NOTE]
@@ -807,10 +824,16 @@ Questa funzione non è disponibile nelle API per lo scripting.
==== strncasecmp
// TRANSLATION MISSING
-_Updated in 1.0._
+_Updated in 1.0, 3.8._
-Confronta stringa indipendente non sensibile alle maiuscole e alla
-localizzazione, per un numero _max_ di caratteri.
+// TRANSLATION MISSING
+Case insensitive string comparison, for _max_ chars.
+
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
Prototipo:
@@ -888,10 +911,10 @@ Questa funzione non è disponibile nelle API per lo scripting.
==== strcmp_ignore_chars
// TRANSLATION MISSING
-_Updated in 1.0._
+_Updated in 1.0, 3.8._
-Confronta una stringa localizzata (e opzionalmente non sensibile alle
-maiuscole), ignorando alcuni caratteri.
+// TRANSLATION MISSING
+String comparison ignoring some chars.
Prototipo:
@@ -909,6 +932,12 @@ Argomenti:
* _chars_ignored_: stringa con caratteri da ignorare
* _case_sensitive_: 1 per il confronto sensibile alle maiuscole, altrimenti 0
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8 when _case_sensitive_ is set to 0: now all
+uppercase letters are properly converted to lowercase (by calling function
+`towlower`), in addition to the range `A` to `Z`.
+
Valore restituito:
* -1 se stringa1 < stringa2
@@ -928,10 +957,16 @@ Questa funzione non è disponibile nelle API per lo scripting.
==== strcasestr
// TRANSLATION MISSING
-_Updated in 1.3._
+_Updated in 1.3, 3.8._
+
+// TRANSLATION MISSING
+Case insensitive string search.
-Cerca una stringa non sensibile alle maiuscole e indipendente dalla
-localizzazione.
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
Prototipo:
@@ -1010,7 +1045,7 @@ length = weechat.strlen_screen("é") # 1
==== string_match
// TRANSLATION MISSING
-_Updated in 1.0._
+_Updated in 1.0, 3.8._
Verifica se una stringa coincide ad una mask.
@@ -1035,6 +1070,12 @@ Argomenti:
Since version 1.0, wildcards are allowed inside the mask
(not only beginning/end of mask).
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8 when _case_sensitive_ is set to 0: now all
+uppercase letters are properly converted to lowercase (by calling function
+`towlower`), in addition to the range `A` to `Z`.
+
Valore restituito:
* 1 se la stringa coincide alla mask, altrimenti 0
@@ -1067,7 +1108,8 @@ match5 = weechat.string_match("abcdef", "*b*d*", 0) # == 1
==== string_match_list
-_WeeChat ≥ 2.5._
+// TRANSLATION MISSING
+_WeeChat ≥ 2.5, updated in 3.8._
// TRANSLATION MISSING
Check if a string matches a list of masks where negative mask is allowed
@@ -1090,6 +1132,12 @@ Argomenti:
is compared to the string with the function <<_string_match,string_match>>
* _case_sensitive_: 1 for case sensitive comparison, otherwise 0
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8 when _case_sensitive_ is set to 0: now all
+uppercase letters are properly converted to lowercase (by calling function
+`towlower`), in addition to the range `A` to `Z`.
+
Valore restituito:
// TRANSLATION MISSING
@@ -3773,10 +3821,16 @@ Questa funzione non è disponibile nelle API per lo scripting.
==== utf8_charcasecmp
// TRANSLATION MISSING
-_Updated in 1.0._
+_Updated in 1.0, 3.8._
Confronta due caratteri UTF-8, ignorando la sensibilità alle maiuscole.
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
+
Prototipo:
[source,c]
diff --git a/doc/ja/weechat_plugin_api.ja.adoc b/doc/ja/weechat_plugin_api.ja.adoc
index 0b5b042bb..c9dd3152b 100644
--- a/doc/ja/weechat_plugin_api.ja.adoc
+++ b/doc/ja/weechat_plugin_api.ja.adoc
@@ -633,9 +633,13 @@ free (str);
_WeeChat バージョン 3.8 で更新。_
// TRANSLATION MISSING
-Return a string with uppercase letters converted to lowercase. +
-This function is locale independent: only letters `A` to `Z` without accents
-are converted to lowercase. All other chars are kept as-is.
+Return a string with uppercase letters converted to lowercase.
+
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`. +
+Moreover, a newly allocated string is returned and must be freed after use.
プロトタイプ:
@@ -657,7 +661,7 @@ C 言語での使用例:
[source,c]
----
-char *str = weechat_string_tolower ("ABCD_É"); /* result: "abcd_É" */
+char *str = weechat_string_tolower ("ABCD_É"); /* result: "abcd_é" */
/* ... */
free (str);
----
@@ -670,9 +674,13 @@ free (str);
_WeeChat バージョン 3.8 で更新。_
// TRANSLATION MISSING
-Return a string with lowercase letters converted to uppercase. +
-This function is locale independent: only letters `a` to `z` without accents
-are converted to uppercase. All other chars are kept as-is.
+Return a string with lowercase letters converted to uppercase.
+
+[NOTE]
+Behavior has changed in version 3.8: now all lowercase letters are properly
+converted to uppercase (by calling function `towupper`), in addition to the
+range `a` to `z`. +
+Moreover, a newly allocated string is returned and must be freed after use.
プロトタイプ:
@@ -694,7 +702,7 @@ C 言語での使用例:
[source,c]
----
-char *str = weechat_string_toupper ("abcd_é"); /* result: "ABCD_é" */
+char *str = weechat_string_toupper ("abcd_é"); /* result: "ABCD_É" */
/* ... */
free (str);
----
@@ -704,15 +712,24 @@ free (str);
==== strcasecmp
-_WeeChat バージョン 1.0 で更新。_
+_WeeChat バージョン 1.0, 3.8 で更新。_
-ロケールと大文字小文字を無視して文字列を比較。
+// TRANSLATION MISSING
+Case insensitive string comparison.
+
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
プロトタイプ:
[source,c]
----
-int weechat_strcasecmp (const char *string1, const char *string2);
+int diff;
+diff = weechat_strcasecmp ("aaa", "CCC"); /* == -1 */
+diff = weechat_strcasecmp ("noël", "NOËL"); /* == 0 */
----
引数:
@@ -730,7 +747,7 @@ C 言語での使用例:
[source,c]
----
-int diff = weechat_strcasecmp ("aaa", "CCC"); /* == -2 */
+int diff = weechat_strcasecmp ("aaa", "CCC"); /* == -1 */
----
[NOTE]
@@ -781,7 +798,14 @@ int diff = weechat_strcasecmp_range ("nick{away}", "NICK[away]", 29); /* == 0 *
_WeeChat バージョン 1.0 で更新。_
-ロケールと大文字小文字を無視して _max_ 文字だけ文字列を比較。
+// TRANSLATION MISSING
+Case insensitive string comparison, for _max_ chars.
+
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
プロトタイプ:
@@ -857,10 +881,10 @@ int diff = weechat_strncasecmp_range ("nick{away}", "NICK[away]", 6, 29); /* ==
==== strcmp_ignore_chars
-_WeeChat バージョン 1.0 で更新。_
+_WeeChat バージョン 1.0, 3.8 で更新。_
-一部の文字列を無視して、ロケールに依存して
-(オプションで大文字小文字の区別をしない) 文字列を比較。
+// TRANSLATION MISSING
+String comparison ignoring some chars.
プロトタイプ:
@@ -878,6 +902,12 @@ int weechat_strcmp_ignore_chars (const char *string1, const char *string2,
* _chars_ignored_: 無視する文字
* _case_sensitive_: 大文字小文字を区別して比較する場合は 1、区別しない場合は 0
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8 when _case_sensitive_ is set to 0: now all
+uppercase letters are properly converted to lowercase (by calling function
+`towlower`), in addition to the range `A` to `Z`.
+
戻り値:
* string1 < string2 の場合は -1
@@ -896,9 +926,16 @@ int diff = weechat_strcmp_ignore_chars ("a-b", "--a-e", "-", 1); /* == -3 */
==== strcasestr
-_WeeChat バージョン 1.3 で更新。_
+_WeeChat バージョン 1.3, 3.8 で更新。_
+
+// TRANSLATION MISSING
+Case insensitive string search.
-ロケールと大文字小文字を区別して文字列を検索。
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
プロトタイプ:
@@ -974,7 +1011,7 @@ length = weechat.strlen_screen("é") # 1
==== string_match
-_WeeChat バージョン 1.0 で更新。_
+_WeeChat バージョン 1.0, 3.8 で更新。_
文字列がマスクにマッチするか確認。
@@ -997,6 +1034,12 @@ int weechat_string_match (const char *string, const char *mask,
WeeChat バージョン 1.0 以上の場合、ワイルドカードをマスクの内部で使うことが可能です
(マスクの最初および最後だけではありません)。
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8 when _case_sensitive_ is set to 0: now all
+uppercase letters are properly converted to lowercase (by calling function
+`towlower`), in addition to the range `A` to `Z`.
+
戻り値:
* マスクにマッチした場合は 1、それ以外は 0
@@ -1029,7 +1072,8 @@ match5 = weechat.string_match("abcdef", "*b*d*", 0) # == 1
==== string_match_list
-_WeeChat バージョン 2.5 以上で利用可。_
+// TRANSLATION MISSING
+_WeeChat ≥ 2.5, updated in 3.8._
文字列が否定マスク
(書式: "!word")
@@ -1050,6 +1094,12 @@ int weechat_string_match_list (const char *string, const char **masks,
各マスクは関数 <<_string_match,string_match>> で文字列と比較されます
* _case_sensitive_: 大文字と小文字を区別する場合は 1、区別しない場合は 0
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8 when _case_sensitive_ is set to 0: now all
+uppercase letters are properly converted to lowercase (by calling function
+`towlower`), in addition to the range `A` to `Z`.
+
戻り値:
* 1 if string matches list of masks (at least one mask matches and no negative
@@ -3697,10 +3747,16 @@ int diff = weechat_utf8_charcmp ("aaa", "ccc"); /* == -2 */
==== utf8_charcasecmp
-_WeeChat バージョン 1.0 で更新。_
+_WeeChat バージョン 1.0, 3.8 で更新。_
大文字小文字の違いを無視して、2 つの UTF-8 文字を比較。
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
+
プロトタイプ:
[source,c]
diff --git a/doc/sr/weechat_plugin_api.sr.adoc b/doc/sr/weechat_plugin_api.sr.adoc
index 3ec897791..c32f7202b 100644
--- a/doc/sr/weechat_plugin_api.sr.adoc
+++ b/doc/sr/weechat_plugin_api.sr.adoc
@@ -594,9 +594,13 @@ free (str);
_Ажурирано у верзији 3.8._
// TRANSLATION MISSING
-Return a string with uppercase letters converted to lowercase. +
-This function is locale independent: only letters `A` to `Z` without accents
-are converted to lowercase. All other chars are kept as-is.
+Return a string with uppercase letters converted to lowercase.
+
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`. +
+Moreover, a newly allocated string is returned and must be freed after use.
Прототип:
@@ -618,7 +622,7 @@ C пример:
[source,c]
----
-char *str = weechat_string_tolower ("ABCD_É"); /* result: „abcd_É” */
+char *str = weechat_string_tolower ("ABCD_É"); /* result: „abcd_é” */
/* ... */
free (str);
----
@@ -631,9 +635,13 @@ free (str);
_Ажурирано у верзији 3.8._
// TRANSLATION MISSING
-Return a string with lowercase letters converted to uppercase. +
-This function is locale independent: only letters `a` to `z` without accents
-are converted to uppercase. All other chars are kept as-is.
+Return a string with lowercase letters converted to uppercase.
+
+[NOTE]
+Behavior has changed in version 3.8: now all lowercase letters are properly
+converted to uppercase (by calling function `towupper`), in addition to the
+range `a` to `z`. +
+Moreover, a newly allocated string is returned and must be freed after use.
Прототип:
@@ -655,7 +663,7 @@ C пример:
[source,c]
----
-char *str = weechat_string_toupper ("abcd_é"); /* result: „ABCD_é” */
+char *str = weechat_string_toupper ("abcd_é"); /* result: „ABCD_É” */
/* ... */
free (str);
----
@@ -665,9 +673,16 @@ free (str);
==== strcasecmp
-_Ажурирано у верзији 1.0._
+_Ажурирано у верзији 1.0, 3.8._
-Поређење стрингова независно од величине слова и локал подешавања.
+// TRANSLATION MISSING
+Case insensitive string comparison.
+
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
Прототип:
@@ -691,7 +706,9 @@ C пример:
[source,c]
----
-int diff = weechat_strcasecmp ("aaa", "CCC"); /* == -2 */
+int diff;
+diff = weechat_strcasecmp ("aaa", "CCC"); /* == -1 */
+diff = weechat_strcasecmp ("noël", "NOËL"); /* == 0 */
----
[NOTE]
@@ -742,7 +759,14 @@ int diff = weechat_strcasecmp_range ("nick{away}", "NICK[away]", 29); /* == 0 *
_Ажурирано у верзији 1.0._
-Поређење стрингова независно од величине слова и локал подешавања, за _max_ карактера.
+// TRANSLATION MISSING
+Case insensitive string comparison, for _max_ chars.
+
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
Прототип:
@@ -817,9 +841,10 @@ int diff = weechat_strncasecmp_range ("nick{away}", "NICK[away]", 6, 29); /* ==
==== strcmp_ignore_chars
-_Ажурирано у верзији 1.0._
+_Ажурирано у верзији 1.0, 3.8._
-Поређење стрингова према локал подешавању (и необавезно независно од величине слова), уз игнорисање неких карактера.
+// TRANSLATION MISSING
+String comparison ignoring some chars.
Прототип:
@@ -837,6 +862,12 @@ int weechat_strcmp_ignore_chars (const char *string1, const char *string2,
* _chars_ignored_: стринг са карактерима који се игноришу
* _case_sensitive_: 1 за поређење које прави разлику у величини слова, у супротном 0
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8 when _case_sensitive_ is set to 0: now all
+uppercase letters are properly converted to lowercase (by calling function
+`towlower`), in addition to the range `A` to `Z`.
+
Повратна вредност:
* -1 ако је string1 < string2
@@ -855,9 +886,16 @@ int diff = weechat_strcmp_ignore_chars ("a-b", "--a-e", "-", 1); /* == -3 */
==== strcasestr
-_Ажурирано у верзији 1.3._
+_Ажурирано у верзији 1.3, 3.8._
+
+// TRANSLATION MISSING
+Case insensitive string search.
-Претрага стринга независно од величине слова и локал подешавања.
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
Прототип:
@@ -931,7 +969,7 @@ length = weechat.strlen_screen("é") # 1
==== string_match
-_Ажурирано у верзији 1.0._
+_Ажурирано у верзији 1.0, 3.8._
Провера да ли стринг задовољава маску.
@@ -952,6 +990,12 @@ int weechat_string_match (const char *string, const char *mask,
[NOTE]
Почевши од верзије 1.0, у маски се дозвољава употреба џокера (не само на почетку/крају маске).
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8 when _case_sensitive_ is set to 0: now all
+uppercase letters are properly converted to lowercase (by calling function
+`towlower`), in addition to the range `A` to `Z`.
+
Повратна вредност:
* 1 ако стринг задовољава маску, у супротном 0
@@ -984,7 +1028,7 @@ match5 = weechat.string_match("abcdef", "*b*d*", 0) # == 1
==== string_match_list
-_WeeChat ≥ 2.5._
+_WeeChat ≥ 2.5, ажурирано у верзији 3.8._
Проверава да ли стринг задовољава листу маски, при чему је дозвољена употреба негативних маски у формату „!реч”. Негативна маска има виши приоритет у односу на стандардну маску.
@@ -1002,6 +1046,12 @@ int weechat_string_match_list (const char *string, const char **masks,
* _masks_: листа маски, са NULL након последње маске у листи; свака маска се пореди са стрингом функцијом <<_string_match,string_match>>
* _case_sensitive_: 1 за поређење које прави разлику у величини слова, у супротном 0
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8 when _case_sensitive_ is set to 0: now all
+uppercase letters are properly converted to lowercase (by calling function
+`towlower`), in addition to the range `A` to `Z`.
+
Повратна вредност:
* 1 ако стринг задовољава листу маски (барем једна од маски је задовољена и ниједна од негативних маски), у супротном 0
@@ -3504,10 +3554,16 @@ int diff = weechat_utf8_charcmp ("aaa", "ccc"); /* == -2 */
==== utf8_charcasecmp
-_Ажурирано у верзији 1.0._
+_Ажурирано у верзији 1.0, 3.8._
Пореди два UTF-8 карактера, уз игнорисање разлике у величини слова.
+// TRANSLATION MISSING
+[NOTE]
+Behavior has changed in version 3.8: now all uppercase letters are properly
+converted to lowercase (by calling function `towlower`), in addition to the
+range `A` to `Z`.
+
Прототип:
[source,c]
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index c5bb8cd3f..f84c49626 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -500,7 +500,7 @@ config_set_word_chars (const char *str_word_chars,
/* char1 */
item = string_strndup (ptr_item, pos - ptr_item);
item2 = string_convert_escaped_chars (item);
- (*word_chars)[i].char1 = utf8_wide_char (item2);
+ (*word_chars)[i].char1 = utf8_char_int (item2);
if (item)
free (item);
if (item2)
@@ -508,7 +508,7 @@ config_set_word_chars (const char *str_word_chars,
/* char2 */
item = strdup (pos + 1);
item2 = string_convert_escaped_chars (item);
- (*word_chars)[i].char2 = utf8_wide_char (item2);
+ (*word_chars)[i].char2 = utf8_char_int (item2);
if (item)
free (item);
if (item2)
@@ -521,7 +521,7 @@ config_set_word_chars (const char *str_word_chars,
if ((*word_chars)[i].wc_class == (wctype_t)0)
{
item = string_convert_escaped_chars (ptr_item);
- (*word_chars)[i].char1 = utf8_wide_char (item);
+ (*word_chars)[i].char1 = utf8_char_int (item);
(*word_chars)[i].char2 = (*word_chars)[i].char1;
if (item)
free (item);
diff --git a/src/core/wee-string.c b/src/core/wee-string.c
index 66bd82153..14bc245e0 100644
--- a/src/core/wee-string.c
+++ b/src/core/wee-string.c
@@ -31,8 +31,8 @@
#include <string.h>
#include <ctype.h>
#include <wctype.h>
-#include <regex.h>
#include <wchar.h>
+#include <regex.h>
#include <stdint.h>
#include <gcrypt.h>
@@ -308,67 +308,89 @@ string_repeat (const char *string, int count)
}
/*
- * Converts uppercase letters to lowercase.
- *
- * This function is locale independent: only letters 'A' to 'Z' without accents
- * are converted to lowercase. All other chars are kept as-is.
- *
- * Note: result must be freed after use.
+ * Converts string to lowercase (locale dependent).
*/
char *
string_tolower (const char *string)
{
- char *result, *ptr_result;
+ char **result, utf_char[5];
if (!string)
return NULL;
- result = strdup (string);
+ result = string_dyn_alloc (strlen (string) + 1);
if (!result)
return NULL;
- ptr_result = result;
- while (ptr_result && ptr_result[0])
+ while (string && string[0])
{
- if ((ptr_result[0] >= 'A') && (ptr_result[0] <= 'Z'))
- ptr_result[0] += ('a' - 'A');
- ptr_result = (char *)utf8_next_char (ptr_result);
+ if (!((unsigned char)(string[0]) & 0x80))
+ {
+ /*
+ * optimization for single-byte char: only letters A-Z must be
+ * converted to lowercase; this is faster than calling `towlower`
+ */
+ if ((string[0] >= 'A') && (string[0] <= 'Z'))
+ utf_char[0] = string[0] + ('a' - 'A');
+ else
+ utf_char[0] = string[0];
+ utf_char[1] = '\0';
+ string_dyn_concat (result, utf_char, -1);
+ string++;
+ }
+ else
+ {
+ /* char ≥ 2 bytes, use `towlower` */
+ utf8_int_string (towlower (utf8_char_int (string)), utf_char);
+ string_dyn_concat (result, utf_char, -1);
+ string = (char *)utf8_next_char (string);
+ }
}
-
- return result;
+ return string_dyn_free (result, 0);
}
/*
- * Converts lowercase letters to uppercase.
- *
- * This function is locale independent: only letters 'a' to 'z' without accents
- * are converted to uppercase. All other chars are kept as-is.
- *
- * Note: result must be freed after use.
+ * Converts string to uppercase (locale dependent).
*/
char *
string_toupper (const char *string)
{
- char *result, *ptr_result;
+ char **result, utf_char[5];
if (!string)
return NULL;
- result = strdup (string);
+ result = string_dyn_alloc (strlen (string) + 1);
if (!result)
return NULL;
- ptr_result = result;
- while (ptr_result && ptr_result[0])
+ while (string && string[0])
{
- if ((ptr_result[0] >= 'a') && (ptr_result[0] <= 'z'))
- ptr_result[0] -= ('a' - 'A');
- ptr_result = (char *)utf8_next_char (ptr_result);
+ if (!((unsigned char)(string[0]) & 0x80))
+ {
+ /*
+ * optimization for single-byte char: only letters a-z must be
+ * converted to uppercase; this is faster than calling `towupper`
+ */
+ if ((string[0] >= 'a') && (string[0] <= 'z'))
+ utf_char[0] = string[0] - ('a' - 'A');
+ else
+ utf_char[0] = string[0];
+ utf_char[1] = '\0';
+ string_dyn_concat (result, utf_char, -1);
+ string++;
+ }
+ else
+ {
+ /* char ≥ 2 bytes, use `towupper` */
+ utf8_int_string (towupper (utf8_char_int (string)), utf_char);
+ string_dyn_concat (result, utf_char, -1);
+ string = (char *)utf8_next_char (string);
+ }
}
-
- return result;
+ return string_dyn_free (result, 0);
}
/*
@@ -1174,11 +1196,11 @@ string_is_word_char (const char *string,
wint_t c;
int i, match;
- c = utf8_wide_char (string);
-
- if (c == WEOF)
+ if (!string || !string[0])
return 0;
+ c = utf8_char_int (string);
+
for (i = 0; i < word_chars_count; i++)
{
if (word_chars[i].wc_class != (wctype_t)0)
diff --git a/src/core/wee-utf8.c b/src/core/wee-utf8.c
index c8756a695..8f6a69cff 100644
--- a/src/core/wee-utf8.c
+++ b/src/core/wee-utf8.c
@@ -394,49 +394,6 @@ utf8_int_string (unsigned int unicode_value, char *string)
}
/*
- * Gets wide char from string (first char).
- *
- * Returns the char as "wint_t", WEOF is string was NULL/empty or in case of
- * error.
- */
-
-wint_t
-utf8_wide_char (const char *string)
-{
- int char_size;
- wint_t result;
-
- if (!string || !string[0])
- return WEOF;
-
- char_size = utf8_char_size (string);
- switch (char_size)
- {
- case 1:
- result = (wint_t)string[0];
- break;
- case 2:
- result = ((wint_t)((unsigned char)string[0])) << 8
- | ((wint_t)((unsigned char)string[1]));
- break;
- case 3:
- result = ((wint_t)((unsigned char)string[0])) << 16
- | ((wint_t)((unsigned char)string[1])) << 8
- | ((wint_t)((unsigned char)string[2]));
- break;
- case 4:
- result = ((wint_t)((unsigned char)string[0])) << 24
- | ((wint_t)((unsigned char)string[1])) << 16
- | ((wint_t)((unsigned char)string[2])) << 8
- | ((wint_t)((unsigned char)string[3]));
- break;
- default:
- result = WEOF;
- }
- return result;
-}
-
-/*
* Gets size of UTF-8 char (in bytes).
*
* Returns an integer between 0 and 4.
@@ -626,13 +583,25 @@ utf8_charcasecmp (const char *string1, const char *string2)
if (!string1 || !string2)
return (string1) ? 1 : ((string2) ? -1 : 0);
- wchar1 = utf8_wide_char (string1);
- if ((wchar1 >= 'A') && (wchar1 <= 'Z'))
- wchar1 += ('a' - 'A');
-
- wchar2 = utf8_wide_char (string2);
- if ((wchar2 >= 'A') && (wchar2 <= 'Z'))
- wchar2 += ('a' - 'A');
+ /*
+ * optimization for single-byte chars: only letters A-Z must be converted
+ * to lowercase; this is faster than calling `towlower`
+ */
+ if (!((unsigned char)(string1[0]) & 0x80)
+ && !((unsigned char)(string2[0]) & 0x80))
+ {
+ wchar1 = string1[0];
+ if ((wchar1 >= 'A') && (wchar1 <= 'Z'))
+ wchar1 += ('a' - 'A');
+ wchar2 = string2[0];
+ if ((wchar2 >= 'A') && (wchar2 <= 'Z'))
+ wchar2 += ('a' - 'A');
+ }
+ else
+ {
+ wchar1 = towlower (utf8_char_int (string1));
+ wchar2 = towlower (utf8_char_int (string2));
+ }
return (wchar1 < wchar2) ? -1 : ((wchar1 == wchar2) ? 0 : 1);
}
@@ -658,17 +627,17 @@ utf8_charcasecmp (const char *string1, const char *string2)
int
utf8_charcasecmp_range (const char *string1, const char *string2, int range)
{
- wint_t wchar1, wchar2;
+ wchar_t wchar1, wchar2;
if (!string1 || !string2)
return (string1) ? 1 : ((string2) ? -1 : 0);
- wchar1 = utf8_wide_char (string1);
- if ((wchar1 >= (wint_t)'A') && (wchar1 < (wint_t)('A' + range)))
+ wchar1 = utf8_char_int (string1);
+ if ((wchar1 >= (wchar_t)'A') && (wchar1 < (wchar_t)('A' + range)))
wchar1 += ('a' - 'A');
- wchar2 = utf8_wide_char (string2);
- if ((wchar2 >= (wint_t)'A') && (wchar2 < (wint_t)('A' + range)))
+ wchar2 = utf8_char_int (string2);
+ if ((wchar2 >= (wchar_t)'A') && (wchar2 < (wchar_t)('A' + range)))
wchar2 += ('a' - 'A');
return (wchar1 < wchar2) ? -1 : ((wchar1 == wchar2) ? 0 : 1);
diff --git a/src/core/wee-utf8.h b/src/core/wee-utf8.h
index 6c5771860..9507ea05d 100644
--- a/src/core/wee-utf8.h
+++ b/src/core/wee-utf8.h
@@ -37,7 +37,6 @@ extern const char *utf8_prev_char (const char *string_start,
extern const char *utf8_next_char (const char *string);
extern int utf8_char_int (const char *string);
extern int utf8_int_string (unsigned int unicode_value, char *string);
-extern wint_t utf8_wide_char (const char *string);
extern int utf8_char_size (const char *string);
extern int utf8_strlen (const char *string);
extern int utf8_strnlen (const char *string, int bytes);
diff --git a/tests/unit/core/test-core-eval.cpp b/tests/unit/core/test-core-eval.cpp
index 248c680fe..c6c18e2eb 100644
--- a/tests/unit/core/test-core-eval.cpp
+++ b/tests/unit/core/test-core-eval.cpp
@@ -538,12 +538,12 @@ TEST(CoreEval, EvalExpression)
/* test case conversion: to lower case */
WEE_CHECK_EVAL("", "${lower:}");
WEE_CHECK_EVAL("this is a test", "${lower:This is a TEST}");
- WEE_CHECK_EVAL("testÉ testé", "${lower:TESTÉ Testé}");
+ WEE_CHECK_EVAL("testé testé", "${lower:TESTÉ Testé}");
/* test case conversion: to upper case */
WEE_CHECK_EVAL("", "${upper:}");
WEE_CHECK_EVAL("THIS IS A TEST", "${upper:This is a TEST}");
- WEE_CHECK_EVAL("TESTÉ TESTé", "${upper:TESTÉ Testé}");
+ WEE_CHECK_EVAL("TESTÉ TESTÉ", "${upper:TESTÉ Testé}");
/* test hidden chars */
WEE_CHECK_EVAL("", "${hide:invalid}");
diff --git a/tests/unit/core/test-core-string.cpp b/tests/unit/core/test-core-string.cpp
index ec8dce52c..24a557cb5 100644
--- a/tests/unit/core/test-core-string.cpp
+++ b/tests/unit/core/test-core-string.cpp
@@ -191,8 +191,9 @@ TEST(CoreString, ToLower)
WEE_TEST_STR(NULL, string_tolower (NULL));
WEE_TEST_STR("", string_tolower (""));
- WEE_TEST_STR("abcd_É", string_tolower ("ABCD_É"));
- WEE_TEST_STR("À É Ï Ô Ü Ÿ Æ Œ Ç", string_tolower ("À É Ï Ô Ü Ÿ Æ Œ Ç"));
+ WEE_TEST_STR("abcd_é", string_tolower ("ABCD_É"));
+ WEE_TEST_STR("àáâãäåæçèéêëìíîïðñòóôõöøœšùúûüýÿ",
+ string_tolower ("ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØŒŠÙÚÛÜÝŸ"));
WEE_TEST_STR("€", string_tolower ("€"));
WEE_TEST_STR("[⛄]", string_tolower ("[⛄]"));
}
@@ -209,8 +210,9 @@ TEST(CoreString, ToUpper)
WEE_TEST_STR(NULL, string_tolower (NULL));
WEE_TEST_STR("", string_toupper (""));
- WEE_TEST_STR("ABCD_é", string_toupper ("abcd_é"));
- WEE_TEST_STR("à é ï ô ü ÿ æ œ ç", string_toupper ("à é ï ô ü ÿ æ œ ç"));
+ WEE_TEST_STR("ABCD_É", string_toupper ("abcd_é"));
+ WEE_TEST_STR("ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØŒŠÙÚÛÜÝŸ",
+ string_toupper ("àáâãäåæçèéêëìíîïðñòóôõöøœšùúûüýÿ"));
WEE_TEST_STR("€", string_toupper ("€"));
WEE_TEST_STR("[⛄]", string_toupper ("[⛄]"));
}
diff --git a/tests/unit/core/test-core-utf8.cpp b/tests/unit/core/test-core-utf8.cpp
index 7051e1478..7da5482b1 100644
--- a/tests/unit/core/test-core-utf8.cpp
+++ b/tests/unit/core/test-core-utf8.cpp
@@ -469,15 +469,6 @@ TEST(CoreUtf8, Convert)
STRCMP_EQUAL(UNICODE_CJK_YELLOW, result);
LONGS_EQUAL(4, utf8_int_string (0x24b62, result));
STRCMP_EQUAL(UNICODE_HAN_CHAR, result);
-
- /* get wide char */
- LONGS_EQUAL(WEOF, utf8_wide_char (NULL));
- LONGS_EQUAL(WEOF, utf8_wide_char (""));
- LONGS_EQUAL(65, utf8_wide_char ("A"));
- LONGS_EQUAL(0xc3ab, utf8_wide_char ("ë"));
- LONGS_EQUAL(0xe282ac, utf8_wide_char ("€"));
- LONGS_EQUAL(0xe2bba9, utf8_wide_char (UNICODE_CJK_YELLOW));
- LONGS_EQUAL(0xf0a4ada2, utf8_wide_char (UNICODE_HAN_CHAR));
}
/*