[Buildroot] [PATCH 08/19] support/check-uniq-files: decode as many strings as possible
Arnout Vandecappelle
arnout at mind.be
Thu Feb 7 23:40:25 UTC 2019
On 07/01/2019 23:05, Yann E. MORIN wrote:
> +# If possible, try to decode the binary string s with the user's locale.
> +# If s contains characters that can't be decoded with that locale, return
> +# the representation (in the user's locale) of the un-decoded string.
> +def str_decode(s):
> + try:
> + return s.decode()
> + except UnicodeDecodeError:
> + return repr(s)
I think s.decode(errors='replace') is exactly what we want: it prints the
question mark character for things that can't be represented, just like ls does.
Regards,
Arnout
More information about the buildroot
mailing list