Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

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

  1. icomment:
    There is another semantic difference even for classification that I did not realize when the string contains multiple characters. Consider Tcl's
    
    ```
    % string is lower 2a
    0
    ```
    
    with Python's
    
    ```
    >>> "2a".islower()
    True
    ```
    
    Python subscribes to the Unicode definition of [isLowercase](https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-3/#G47728) where a string is lower case if each character in the string maps to itself under tolower operation. Thus `2` passes the test. Tcl on the other hand uses a definition that each character in the string must be classified as lowercase which is false for `2`.
    
    Aside from the fact that some clarity in the Tcl manpage would be helpful, **I don't consider this a bug in Tcl** but simply different defined semantics. I would not change Tcl's behaviour in this regard but instead (**only if deemed useful**) analogous commands reflecting the Unicode standard definitions should be added to the `unicode` command. That would of course require a TIP (not 726, because I do not want to conflate this issue with normalization).
    
    (Note this issue is orthogonal to Tcl's lowercase classification of individual code points like `\u00aa` which was the original ticket I logged. Even if that was "fixed" it would not affect this difference)
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"