Re: BUG #3730: Creating a swedish dictionary fails - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: BUG #3730: Creating a swedish dictionary fails
Date
Msg-id 20071109191015.GC7161@alvh.no-ip.org
Whole thread Raw
In response to Re: BUG #3730: Creating a swedish dictionary fails  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #3730: Creating a swedish dictionary fails  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Tom Lane wrote:
> Alvaro Herrera <alvherre@commandprompt.com> writes:
> > I am wondering if the newline being included in the token could be
> > causing a problem.
>
> Nope.  I traced through it and the problem is that char2wchar() is
> completely brain-dead: at some places it thinks that "len" is the
> length of the output wchar array, and at others it thinks that "len"
> is the number of bytes in the input.  In particular, _t_isalpha()
> fails completely for any multibyte character, because the pnstrdup
> call truncates the character to 1 byte.

Ah, that explains it.  I was reading that code too and did not
understand what was going on.

> After looking at the callers I'm inclined to think that the only
> safe way to implement this routine is to change its API to provide
> both counts.  Comments?

+1

--
Alvaro Herrera                         http://www.flickr.com/photos/alvherre/
Licensee shall have no right to use the Licensed Software
for productive or commercial use. (Licencia de StarOffice 6.0 beta)

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #3730: Creating a swedish dictionary fails
Next
From: Euler Taveira de Oliveira
Date:
Subject: Re: BUG #3734: Invalid XML schema output.