Eli Zaretskii <
address@hidden> schrieb am Sa., 23. Dez. 2017 um 14:44 Uhr:
> From: Philipp Stephani <address@hidden>
> Date: Sat, 23 Dec 2017 12:33:46 +0000
> Cc: address@hidden, address@hidden
>
> This patch only improves the error symbol when trying to serialize a non-Unicode string to JSON. Right now
> this raises "out of memory", which is somewhat confusing. This patch improves this to raise
> "wrong-type-argument".
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.