Overview
| Artifact ID: | 0a3d75bfac1d6a314663f17490a33dba25fbbe1a91d835fed2a66ee0c2c060a8 |
|---|---|
| Ticket: | 1ecea01196a19b73226d5c822e5fdaf22111aa54
string is lower, upper not consistent with Unicode database and other languages |
| User & Date: | sebres on 2025-07-23 17:08:27 |
Changes
- icomment:
At least regarding RE, I am unsure it shall be always true... For instance PCRE and PCRE2 don't consider it as lowercase:<br/> (`\p{Ll}` token is the same as `[[:lower:]]` in tcls NFA) ``` % regexp -type pcre {^\p{Ll}+$} \u0061\u00e4\u0430 1 % regexp -type pcre {^\p{Ll}+$} \u00aa 0 ``` or PoC from bash: ``` $ printf "\\u0061\\u00e4\\u0430\n" | pcre2grep -q '\p{Ll}' && echo 1 || echo 0 1 $ printf "\\u00aa\n" | pcre2grep -q '\p{Ll}' && echo 1 || echo 0 0 ``` Also JS agrees with that: ``` > /^\p{Lowercase_Letter}+$/u.exec("\u0061\u00e4\u0430") && true true > /^\p{Lowercase_Letter}+$/u.exec("\u00aa") && true null ``` It can be simply the bugs in both RE-engines, but the root of issue may be different... Apropos other langs like Python does report it as lowercase. They do indeed, but how about alternative simply logic - could it be called lowercase if there is simply no uppercase for that char? With other words, why then this behaves like it behaves here? ``` >>> "\u00aa".islower() True >>> "\u00aa".isupper() False >>> "\u00aa".lower() == "\u00aa".upper() True >>> "\u00aa" == "\u00aa".lower() and "\u00aa" != "\u00aa".upper() False ``` Using the logic (detect lowercase only if it has uppercase too), may be the explanation for the issues with RE. Yes, there are also regular lowercase characters that do not have corresponding uppercase representations, like the German sharp s (ß), that do not have a direct uppercase equivalent. Just take a look what python does for that char: ``` >>> "ß".lower() == "ß".upper() False >>> "ß" == "ß".lower() and "ß" != "ß".upper() True >>> "ß".lower() 'ß' >>> "ß".upper() 'SS' ``` Another cause (why REs don't recognize them) may be simply the decision to ignore all chars from [other letters](https://www.compart.com/en/unicode/category/Lo), [modifier letters](https://www.compart.com/en/unicode/category/Lm) and other similar categories (for unknown but maybe justified reasons). However I really don't understand how ordinal indicators (which class basically represents indicators following ordinal numbers), or even such as [modifier letter](https://www.compart.com/en/unicode/category/Lm) like ʶ ("\u02B6"), which is capital inverted R, may be lowercase at all... Not trying to convince or propagate what is right here, but to show the subject may be more complex as it is. - login: "sebres"
- mimetype: "text/x-markdown"