Thread: ilike locale problems on cygwin

ilike locale problems on cygwin

From
Per Nyfelt
Date:
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

Re: ilike locale problems on cygwin

From
Jason Tishler
Date:
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

Re: ilike locale problems on cygwin

From
Per Nyfelt
Date:
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