Re: [PGdocs] fix description for handling pf non-ASCII characters
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-06-29T02:58:23Z
Lists: pgsql-hackers
On Fri, Jun 23, 2023 at 10:25 PM Hayato Kuroda (Fujitsu)
<kuroda.hayato@fujitsu.com> wrote:
>
> Dear hackers,
>
> While discussing based on the article[1] with Japanese developers,
> I found inconsistencies between codes and documents.
>
> 45b1a67a[2] changed the behavior when non-ASCII characters was set as application_name,
> cluster_name and postgres_fdw.application_name, but it seemed not to be documented.
> Previously non-ASCII chars were replaed with question makrs '?', but now they are replaced
> with a hex escape instead.
>
> How do you think? Is my understanding correct?
>
> Acknowledgement:
> Sawada-san and Shinoda-san led the developer's discussion.
> Fujii-san was confirmed my points. Thank you for all of their works!
>
> [1]: https://h50146.www5.hpe.com/products/software/oe/linux/mainstream/support/lcc/pdf/PostgreSQL16Beta1_New_Features_en_20230528_1.pdf
> [2]: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=45b1a67a0fcb3f1588df596431871de4c93cb76f;hp=da5d4ea5aaac4fc02f2e2aec272efe438dd4e171
>
> Best Regards,
> Hayato Kuroda
> FUJITSU LIMITED
>
in your patch:
> printable ASCII characters will be replaced with a hex escape.
My wording is not good. I think the result will be: ASCII characters
will be as is, non-ASCII characters will be replaced with "a hex
escape".
set application_name to 'abc漢字Abc';
SET
test16=# show application_name;
application_name
--------------------------------
abc\xe6\xbc\xa2\xe5\xad\x97Abc
(1 row)
I see multi escape, so I am not sure "a hex escape".
to properly render it back to 'abc漢字Abc'
here is how i do it:
select 'abc' || convert_from(decode(' e6bca2e5ad97','hex'), 'UTF8') || 'Abc';
I guess it's still painful if your application_name has non-ASCII chars.
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
doc: Fix descriptions related to the handling of non-ASCII characters
- 950e236e5069 16.1 landed
- 3ef18a90bdea 17.0 landed
-
pg_clean_ascii(): escape bytes rather than lose them
- 45b1a67a0fcb 16.0 cited
-
Make locale option behavior more consistent
- da5d4ea5aaac 16.0 cited