Re: UNICODE

Поиск
Список
Период
Сортировка
От Marko Kreen
Тема Re: UNICODE
Дата
Msg-id 20011028125354.A13053@l-t.ee
обсуждение исходный текст
Ответ на UNICODE  (Jean-Michel POURE <jm.poure@freesurf.fr>)
Ответы Re: UNICODE  (Jean-Michel POURE <jm.poure@freesurf.fr>)
Список pgsql-hackers
On Sun, Oct 28, 2001 at 09:22:24AM +0100, Jean-Michel POURE wrote:
> 
> I am running PostgreSQL 7.1.2 with UNICODE support in production.
> Maybe I miss something about UNICODE:
> 
> CREATE TABLE "test" (
>   "source_oid" serial,
>   "source_timestamp" timestamp,
>   "source_creation" date DEFAULT 'now',
>   "source_modification" date DEFAULT 'now',
>   "source_content" text
> );
> 
> INSERT INTO test (source_content) VALUES ('Photocopie du permis de 
> construire accepté.');
> 
> Now, when trying :
> SELECT * FROM test WHERE source_content ILIKE '%accept%';  ---> returns the 
> record;
> SELECT * FROM test WHERE source_content ILIKE '%accepté%' ---> returns 
> nothing
> SELECT * FROM test WHERE source_content ILIKE '%accepte%' ---> returns 
> nothing
> 
> The same happens from ODBC, PHP and psql. Can you reproduce this?

Sorry, I misinterpreted what your problem is.  I somehow thought
you want the 'é' and 'e' produce same result - for that you need
to mess with locale, but LIKE does not use locale anyway...

Now I reread you message and here's hint:

* If client_encoding == server_encoding, the bytes are put into DB as-is - no conversion is done.

So are you abslutely sure you have on client side UTF8 strings?
Unfortunately you cant use client_encoding=latin1 as PostgreSQL 
refuses the do the conversion between them.  (I am with 7.1.3)

Eg. I did the following:

* created db with encoding = UNICODE
* Put your example into test.sql
* iconv -f latin1 -t utf8 test.sql > test2.sql
* psql < test2.sql

and it worked as it should...


-- 
marko



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jean-Michel POURE
Дата:
Сообщение: Re: UNICODE
Следующее
От: Jean-Michel POURE
Дата:
Сообщение: Re: UNICODE