I wrote:
> What about the other way around: use the \u output convention only for
> things we can specifically identify as control chars, and assume that
> anything else with zero width is a combining char? Is there anything
> other than 0-31 and 128-159 that should really get the \u treatment?
Actually, looking at the comments for ucs_wcwidth() in wchar.c, it seems
that this is already accounted for in the "dsplen" output: characters
for which -1 is returned are control characters, characters for which
0 is returned should be printed as-is and counted as zero width. So the
bug is just that pg_wcsformat conflates the two cases.
regards, tom lane