• binary decode hex ignores additional digits

    From Harald Oehlmann@21:1/5 to All on Fri Nov 19 08:20:00 2021
    Dear TCL team,

    may I offer my personal opinion on the great "binary decode hex" command
    in tcl 8.6.10:

    % string length [binary decode hex -strict 404]
    1
    % string length [binary decode hex -strict 4]
    0

    So, any trailing xdigit of an impair string count is ignored.

    IMHO:
    - this is sometimes not helpful
    - this is not documented.
    - this may throw an error with the strict option.

    I would also love, that the "string is xdigit" would throw an error, if
    the string length is impair, at least with the -strict option.

    Any opinions on this behaviour?

    ---

    For "binary decode base64", it is implemented differently:

    % binary encode base64 a
    YQ==
    % binary decode base64 YQ===
    a
    % binary decode base64 -strict YQ===
    invalid base64 character "=" at position 3

    This is in conformance to the documentation.

    ---

    Thank you all for great TCL,
    Harald

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)