[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [PATCH] Quoted String "%q" non-ascii escaping (w/ hex).
- From: Duane Leslie <parakleta@...>
- Date: Fri, 30 Jun 2017 09:45:44 +1000
> On 29 Jun 2017, at 03:18, Niccolo Medici <niccolomedici@gmail.com> wrote:
>
>> On 6/28/17, Duane Leslie <parakleta@darkreality.org> wrote:
>> Hi,
>>
>> I had a problem with the quoted string format producing strings that
>> were not legal UTF-8 [...]
>
> What do you mean? I don't see any problem:
>
> `string.format("%q", "Здравствуйте")` returns '"Здравствуйте"'. That's
> valid UTF-8.
Attached is a UTF-8 aware version of the `addquoted` function. I'm not sure if it really fits given that the UTF-8 behaviour is attached to a different library, but it might be useful to someone and it's better than my last proposal.
Also, I have noticed that the `utf8_decode` function passes the UTF-16 surrogates which are illegal codepoints, so this might also need to be fixed.
Regards,
Duane.
Attachment:
addquoted.c
Description: Binary data