Re: Unicode escapes with any backend encoding

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: John Naylor <john.naylor@2ndquadrant.com>
Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>, Chapman Flack <chap@anastigmatix.net>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2020-03-06T19:19:13Z
Lists: pgsql-hackers
John Naylor <john.naylor@2ndquadrant.com> writes:
> Not this patch's job perhaps, but now that check_unicode_value() only
> depends on the input, maybe it can be put into pgwchar.h with other
> static inline helper functions? That test is duplicated in
> addunicode() and pg_unicode_to_server(). Maybe:

> static inline bool
> codepoint_is_valid(pgwchar c)
> {
>    return (c > 0 && c <= 0x10FFFF);
> }

Seems reasonable, done.

> Maybe Chapman has a use case in mind he can test with? Barring that,
> the patch seems ready for commit.

I went ahead and pushed this, just to get it out of my queue.
Chapman's certainly welcome to kibitz some more of course.

			regards, tom lane



Commits

  1. Allow Unicode escapes in any server encoding, not only UTF-8.