Closed wismill closed 2 months ago
Hmm the use of strtol
with base 0
parses strings starting with 0
as octal numbers. We should probably strip leading zeros to parse only decimal and hexadecimal numbers. It’s too easy to copy a Unicode code point from the standard format (e.g. U+0061
) and get unexpected result.
A big part of the new code is about UTF-8 to UTF-32 decoding. It’s kept as an internal API for now. I added the related tests.
Note that we could go further and try to parse a keysym name without the --keysym
flag, if previous attempts to parse as a code point / plain character failed. Maybe a new flag --codepoint
would be useful then for completeness.
Currently the positional parameter of the CLI is either a Unicode code point or a keysym. However their respective format is not documented.
It turns out that there are multiple issues due to the use of
strtol
:wev
) so it is worth to bring symmetry with code points.U+NNNN
format is the standard format for Unicode code points but is not supported.Fixed the issues above:
0xNNNN
orU+NNNN
.0xNNNN
;--help
message and manual.