[PATCH 4/4] gdb/python: handle non utf-8 characters when source highlighting

Patrick Monnerat patrick@monnerat.net
Tue Jan 11 19:42:54 GMT 2022


On 1/11/22 20:24, Tom Tromey wrote:
>>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes:
> Andrew> We could try and make GDB smarter when it comes to converting C
> Andrew> strings into Python Unicode objects; this would probably require us to
> Andrew> just try a couple of different encoding schemes rather than just
> Andrew> giving up after utf-8.
>
> Perhaps it should be using the host charset here.
>
> Anyway, FWIW, I think this patch looks reasonable.
>
I did not follow all the discussion, but did you consider using 
surrogate escapes 
(https://docs.python.org/3/library/codecs.html#error-handlers) ?

I used that in RabbitCVS with quite good results.

Just my 2 cents,

Patrick



More information about the Gdb-patches mailing list