From: Tom Lane <tgl@sss.pgh.pa.us>
To: h8mastre@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15476: Problem on show_trgm with 4 byte UTF-8 characters
Date: Sat, 03 Nov 2018 00:44:30 -0400
Message-ID: <2101.1541220270@sss.pgh.pa.us> (raw)
In-Reply-To: <15476-4314f480acf0f114@postgresql.org>
References: <15476-4314f480acf0f114@postgresql.org>
=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> On Encoding=UTF-8 database, try:
> SELECT show_trgm('123');
> → OK
> SELECT show_trgm('日本語');
> → probably OK.
> SELECT show_trgm('🔍');
> ERROR: invalid multibyte character for locale
> HINT: The server's LC_CTYPE locale is probably incompatible with the
> database encoding.
> SQL state: 22021
I failed to reproduce this on a Linux machine. It looks to me like the
problem is that Windows' MultiByteToWideChar doesn't think that UTF8
character is valid.
> Please check: t_isdigit, t_isspace, t_isalpha, and t_isprint.
> https://github.com/postgres/postgres/blob/322548a8abe225f2cfd6a48e07b99e2711d28ef7/src/backend/tsear...
> char2wchar 4th parameter should take number of input bytes. However they
> pass character count.
> int clen = pg_mblen(ptr);
> ...
> char2wchar(character, 2, ptr, clen, mylocale);
Huh? pg_mblen returns the number of bytes in a multibyte character,
so this looks fine to me.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, h8mastre@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15476: Problem on show_trgm with 4 byte UTF-8 characters
In-Reply-To: <2101.1541220270@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox