Subject: Re: bug#44173: 28.0.50; gdb-mi mangles strings with octal escapes

From: Mattias Engdegård <[email-masked]>
Date: Fri, 23 Oct 2020 14:41:02 +0200

23 okt. 2020 kl. 14.01 skrev Eli Zaretskii <[email-masked]>:

> I'm okay with writing a GDB/MI parser, but I'm not sure I understand
> how would that help to solve this particular conundrum.  AFAIR,
> there's a genuine ambiguity there regarding non-ASCII characters
> reported from GDB.

Would you mind explaining the ambiguity? Do you mean what coding system should be used for "\303\266" -- whether it should be interpreted as a string of those two bytes, the string "Ã¶", the string "ö", or something else?
This bug is not about the encoding; it's about not interpreting the string as "303266".

>  Could you tell how will this be solved by a
> different parser?

Again, I'm not sure what you mean. The bug arises because we feed incorrectly translated data into a JSON parser. If we parse the string ourselves instead of going via JSON, that particular problem goes away.

> P.S. Btw: gdb-mi.el already has a BNF parser for GDB/MI.

It doesn't parse the lower parts of the grammar -- 'result', 'value' and so on. JSON is used for that.