Re: ilike locale problems on cygwin

Lists: pgsql-cygwin
From: Per Nyfelt <per(dot)nyfelt(at)resourcing(dot)se>
To: pgsql-cygwin(at)postgresql(dot)org
Subject: ilike locale problems on cygwin
Date: 2003-01-20 11:04:26
Message-ID: 200301201204.26302.per.nyfelt@resourcing.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin

I'm running Postgres 7.3.1 configured with --with-mb=UNICODE --with-locale on
both Linux (Slackware 8.1) and Windows 2000 (cygwin 1.3.18 (0.69/3/2))

The data stored will be english, swedish, danish, norwegian, chinese and
german so I want to use UNICODE encoding to be able to support that. I also
need to be able to ignore cases (when the characters stored have such a thing
as cases) so this is why i need locale support so that I can set one database
that has swedish data to sv_SE, zh_CN for the one with chinese data etc.

On Linux everything works fine, I am able to insert and retrieve data without
problems. On Cygwin, however, when I'm using ilike(), lower() and upper() I
don't get characters other than A-Z converted.

databases are initialized as follows:

initdb -E UNICODE --lc-ctype=sv_SE -D /usr/local/pgsql/data

and created as follows:

> psql -l
List of databases
Name | Owner | Encoding
-----------+----------+----------
rpn | postgres | UNICODE
template0 | postgres | UNICODE
template1 | postgres | UNICODE

Using a Java swing client (dbVisualizer) and the JDBC driver (pg73jdbc3.jar)
to connect to the database:

SHOW CLIENT_ENCODING
returns the value "UNICODE" (my quotes)

create table test(
name varchar(30)
);

insert into test values ('Övik');

select * from test where name ilike '%öv%';
gives me the expected result "Övik" (my quotes)

So on Linux everything works fine: all conversions works as expected, but on
Cygwin

select * from test where name ilike '%öv%';
gives me no matches but

select * from test where name ilike '%Öv%';
gives me the expected result "Övik" (my quotes)

I've tried to initialize the db using both --lc-ctype=sv_SE and --lc-ctype=sv
but neither of them gives me the correct result it still seems to be using
standard C locale (my guess) for character conversion.

The Cygwin environment is installed without any modifications. I just followed
the instructions for setting up Postgres.
/usr/share/locale has a subdir for sv and /usr/share/locale/locale.alias has
the following value for swedish: sv_SE.ISO-8859-1

Any suggestions for how to make Postgres on Cygwin behave the same way as on
linux with regards to locale settings and ilike would be most welcome.

Best regards,
Per


From: Jason Tishler <jason(at)tishler(dot)net>
To: Per Nyfelt <per(dot)nyfelt(at)resourcing(dot)se>
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: ilike locale problems on cygwin
Date: 2003-01-20 15:00:32
Message-ID: 20030120150032.GA1444@tishler.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin

Per,

On Mon, Jan 20, 2003 at 12:04:26PM +0100, Per Nyfelt wrote:
> Any suggestions for how to make Postgres on Cygwin behave the same way
> as on linux with regards to locale settings and ilike would be most
> welcome.

Unfortunately, Cygwin does not fully support locale. Patches gratefully
accepted.

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6


From: Per Nyfelt <per(dot)nyfelt(at)resourcing(dot)se>
To: Jason Tishler <jason(at)tishler(dot)net>
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: ilike locale problems on cygwin
Date: 2003-01-23 18:07:26
Message-ID: 200301231907.26588.per.nyfelt@resourcing.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin

Thanks for the information Jason. I'll see what I can do...

Best regards,
Per

On Monday 20 January 2003 16.00, Jason Tishler wrote:
> Per,
>
> On Mon, Jan 20, 2003 at 12:04:26PM +0100, Per Nyfelt wrote:
> > Any suggestions for how to make Postgres on Cygwin behave the same way
> > as on linux with regards to locale settings and ilike would be most
> > welcome.
>
> Unfortunately, Cygwin does not fully support locale. Patches gratefully
> accepted.
>
> Jason