Subject: Re: bug#66698: I think hex decoding with basenc -d --base16 should be case-insensitive

From: Pádraig Brady <[email-masked]>
Date: Mon, 23 Oct 2023 14:08:17 +0100

On 23/10/2023 13:50, Niels Möller wrote:
> Pádraig Brady <[email-masked]> writes:
> 
>> Will apply the attached later.
>> Marking this as done.
> 
> Thanks! It would make some sense to me to also have options
> --upper/--lower; on encoding, they would specify case of the output, on
> decoding, they would reject the other case (with default being to accept
> either). But less important than fixing the default behavior.

I was thinking `tr '[:lower:]' '[:upper:]'` would suffice for that when encoding.
When decoding I don't see much need for the strictness, but that could
also be enforced easily by prefiltering with something like `tr 'A-F' x`

The same argument could be made of course for not needing this patch at all,
by prefiltering through tr.  However the default operation should be the
most common requirement (and also the RFC documented operation in this case).
A similar case I hit very frequently is pasting hex into bc, and it's
very annoying to have to convert to uppercase before doing this.

>> +  basenc --base16 -d no supports lower case hexadecimal characters.
>> +  Previously an error was given for lower case hex digits.
> 
> s/ no / now /

Thanks, pushed.

Pádraig.