View Ticket
Not logged in
Ticket UUID: 5e6ae6e05ef86f233316cb0294a683afd3306a70
Title: Implement -strict correctly for cesu-8
Type: Bug Version: 8.7
Submitter: jan.nijtmans Created on: 2023-02-16 11:11:25
Subsystem: 11. Conversions from String Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2023-02-16 21:32:23
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2023-02-16 21:32:23
Description:

The cesu-8 encoding is slightly different from utf-8, which has a subtile effect on "-strict"

Examples:

    % encoding convertfrom -strict cesu-8 \xC0\x80
    % encoding convertfrom -strict cesu-8 \xF1\x86\x83\x9C
    񆃜

Those 2 examples are illegal in cesu-8. \xC0\x80 is not illegal in modified cesu-8 (See TCL_ENCODING_MODIFIED flag, but this flag is not accessable at script level). The second example is a code point > 0xFFFF, which should be encoded as 2 surrogates in cesu-8.

Expected:

    % encoding convertfrom -strict cesu-8 \xC0\x80
    unexpected byte sequence starting at index 0: '\xC0'
    % encoding convertfrom -strict cesu-8 \xF1\x86\x83\x9C
    unexpected byte sequence starting at index 0: '\xF1'

User Comments: jan.nijtmans added on 2023-02-16 21:32:23:

Fixed [345299048d944cb3|here]. Closing.