Re: UTF8 regexp and char classes still does not work

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sergey Burladyan <eshkinkot(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: UTF8 regexp and char classes still does not work
Date: 2010-09-28 22:00:52
Message-ID: 29812.1285711252@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sergey Burladyan <eshkinkot(at)gmail(dot)com> writes:
> As i can see in Tom's patch 0d323425 only functions like pg_wc_isalpha is changed, but
> this pg_wc_isalpha is called from
> static struct cvec *
> cclass(struct vars * v, /* context */
> const chr *startp, /* where the name starts */
> const chr *endp, /* just past the end of the name */
> int cases) /* case-independent? */
> function, and this function have comment "For the moment, assume that only char codes < 256 can be in these classes" and it call pg_wc_isalpha like this:
> for (i = 0; i <= UCHAR_MAX; i++)
> {
> if (pg_wc_isalpha((chr) i))
> addchr(cv, (chr) i);
> }
> UCHAR_MAX is 255

Hmm, you're right. I only tested that on Latin1 characters, for which
it does work because those have Unicode points below 256. I'm not
sure of a reasonable solution for the general case --- we certainly
don't want this function iterating up to 2^21 or thereabouts.

Your test case seems to be using KOI8 encoding, though, which doesn't
have anything to do with UTF8 behavior.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2010-09-28 22:04:15 Re: Proposal: plpgsql - "for in array" statement
Previous Message Bruce Momjian 2010-09-28 21:39:52 Re: documentation udpates to pgupgrade.html