Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: fa00228be39f309876d7ec1b940bc82496873e8e44552345c80c5045f75f8433
Ticket: 1ecea01196a19b73226d5c822e5fdaf22111aa54
string is lower, upper not consistent with Unicode database and other languages
User & Date: apnadkarni on 2025-07-24 05:07:44
Changes

  1. icomment:
    
    In response to Sergey, of course the subject of case is complex, particularly conversion or folding, which is why I only addressed the `islower` behavior and not the `tolower,toupper` which is a bigger can of worms and needs more thought.
    
    
    > For instance PCRE and PCRE2 don't consider it as lowercase
    
    The issue with PCRE is the same as with Tcl except that PCRE2 clearly documents the semantics that `\p{Ll}`, `\p{Nd}` etc. refer to the Unicode general category properties "Ll", "Nd" etc. 
    
    > Also JS agrees with that:
    
    For the same reason. It is documented as general category lookup.
    
    My contention is that it is not desired behavior for categorizing lower case characters because in my opinion lower case characters should be exactly those to which the Unicode standard assigns the `Lowercase` property. I would not say PCRE or JS have a bug because they specifically document the semantics of `\p{}` as membership in a specific general category. Still, I don't think it is desirable behavior. Tcl on the other hand does not document `is lower` in terms of Unicode general categories at all.
    
    > "\u00aa" == "\u00aa".lower() and "\u00aa" != "\u00aa".upper()
    > False
    
    Characters that do have a lowercase/uppercase property do not necessarily have a upper case, lower case equivalent. The mapping function then maps it to itself (just as `string toupper 1 -> 1`) so the second clause above is false.
    
    > `>>> "ß".upper()`
    >> 'SS'
    
    That seems correct to me. Python seems to use the [Uppercase_Mapping](https://www.unicode.org/reports/tr44/#Uppercase_Mapping) property as opposed to [Simple_Uppercase_Mapping](https://www.unicode.org/reports/tr44/#Simple_Uppercase_Mapping). As I said *mapping* is a different kettle of fish than *classification* and needs a more complex discussion.
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"