Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Implement -strict correctly for cesu-8

Closed / Fixed5e6ae6e05ef86f233316cb0294a683afd3306a70Created 4 years agoUpdated 4 years ago
Descriptionwiki2023-02-16 11:11:25
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'
Referenced by2
jan.nijtmanswiki2023-02-16 21:32:23

Fixed [here]. Closing.

Log in (anonymous is fine) to add a comment.