Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 8a61cc4a5769b1cd796bd9beac5dc4a4ab72e4ebd7e963c413fd1afe111d0322
Ticket: d10d6ddf295864389294b966163a23a58b9a1e72
UTF-16 Unicode escapes should continue to work in version 9.0
User & Date: apnadkarni on 2024-08-12 17:09:10
Changes

  1. icomment:
    @bhaible, since you mentioned 29 years of Tcl :-) compare Tcl 8.6.4 with Tcl 9 when it comes to scanning the \uxxxx sequences.
    
    ```
    % package req Tcl
    8.6.4
    % scan \ud83d\ude03 %c%c
    55357 56835
    ```
    
    and
    
    ```
    % package req Tcl
    9.0b3
    % scan \ud83d\ude03 %c%c
    55357 56835
    ```
    
    The parsing/scanning is identical as you see.
    
    On the other hand, newer Tcl 8.6.x are different (x >= 10?)
    
    ```
    % package req Tcl
    8.6.14
    % scan \ud83d\ude03 %c%c
    128515 {}
    ```
    
    Note how 8.6.14 differs from 8.6.4. This is what I was referring to earlier.
    
    Now with reference to your puts example, as you can see, the scan characters are NOT combined in either 8.6.4 or 9.0 so the presumption that it is a parsing/scanning problem in 9.0 does not seem likely given your statement that 8.6 never had this issue. Rather as Jan hints at in his response, the difference seems to be that Tcl 9 is stricter to the Unicode standard about where surrogates may appear in I/O. In particular, surrogates should never appear anywhere except in a UTF-16 stream, not even in UTF-8 or UTF-16 streams. Thus the error on the puts command. And there was plenty of debate on this and the migration pain this might cause but the closer adherence to the Unicode standard on exchange of data was deemed important.
    
    With respect to the original problem you are having, I understand where you are coming from. **Opinion**: However, the fact is that Tcl 8.6, no matter what version, never properly supported characters outside the BMP, no matter stuff that "happened to work". That includes 8.6.11 and later that combine surrogates in some instances and not others. Applications that expect to run on 8.6 should not be using those characters in message files (or any source files for that matter.) While it may have been a workaround in Tcl 8 in cases where post-BMP were mandated, there is no reason to continue doing so now that Tcl 9 with full Unicode is here. But as I said, that's my opinion.
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"