emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Improve error reporting when serializing non-Unicode strings


From: Eli Zaretskii
Subject: Re: [PATCH] Improve error reporting when serializing non-Unicode strings to JSON
Date: Sat, 23 Dec 2017 16:52:16 +0200

> From: Philipp Stephani <address@hidden>
> Date: Sat, 23 Dec 2017 14:29:56 +0000
> Cc: address@hidden, address@hidden
> 
>  OK, but why do we need external functions for doing that?  What is
>  missing in our own code to detect such a situation?
> 
> Not much I think, it's just easiest to use Gnulib functions because they are 
> well-documented, have a clean
> interface, and are probably bug-free.
> coding.c has check_utf_8, which is quite similar, but has an incompatible 
> interface (it takes struct
> coding_system objects) and also checks for embedded newlines, which isn't 
> necessary here. 

So let's use check_utf_8, as its downsides don't sound serious to me,
and OTOH using unistring functions will bloat Emacs for the benefit of
a single use case, not to mention create two different methods for
doing the same job, which IMO is even more confusing to any newcomer
to the Emacs internals.

Btw, doesn't find_charsets_in_text do the same job cleaner and
quicker?  AFAIU, all you need is make sure there are no characters
from the 2 eight-bit-* charsets in the text, or did I miss something?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]