Steve Haslam (araqnid@debian.org) reports a bug with a severity of 2
The lower the number the more severe it is.
Short Description
Unable to use LATIN9 (=ISO-8859-15) encoding
Long Description
I am trying to use LATIN9 (ISO-8859-15) as my client encoding rather than LATIN1-- the database I am using is encoded
asUNICODE. However, if I attempt to use the LATIN9 encoding, I get erroneous results. I am using PostgreSQL 7.3 from
Debianunstable (7.3rel-3), which gives a version() string of "PostgreSQL 7.3 on i386-pc-linux-gnu, compiled by GCC
2.95.4".
From PSQL, if I perform:
\encoding LATIN9
insert into i18ntest(id, data) values('Euro symbol', '¤');
then I would expect this to insert a euro symbol into the data column (code point 164 is Euro in ISO-8859-15). However,
whenI change back to UTF-8, the UTF-8 data is "¤", which is the currency symbol.
Now, if I try to insert the Euro symbol using a UNICODE client encoding, then I get an error when I switch back to
LATIN9and SELECT it out again:
psql:/home/steve/public_html/i18ntest.sql:35: WARNING: UtfToLocal: could not convert UTF-8 (0xe282ac). Ignored
However, if I switch to LATIN1 and try to SELECT it, I get a conversion error, which is correct since the euro symbol
doesnot have a code point in LATIN1:
psql:/home/steve/public_html/i18ntest.sql:33: ERROR: Could not convert UTF-8 to ISO8859-1
Sample Code
-- this code is available at http://araqnid.ddts.net/~steve/i18ntest.sql in case it gets munged by the
form/browser/server
-- This is done in a database with "UNICODE" encoding
-- e.g.:
-- create database i18ntest encoding = 'UNICODE';
-- \connect i18ntest
select version();
drop table i18ntest;
create table i18ntest(id text primary key, data text not null);
begin;
\encoding LATIN1
insert into i18ntest(id, data) values('Pound sign', '£');
\encoding LATIN9
insert into i18ntest(id, data) values('Euro symbol', '¤');
commit;
\encoding UNICODE
select id, data from i18ntest;
\encoding LATIN1
select id, data from i18ntest;
\encoding LATIN9
select id, data from i18ntest;
begin;
\encoding UNICODE
update i18ntest set data = '£' where id = 'Pound sign';
update i18ntest set data = 'â\202¬' where id = 'Euro symbol';
commit;
\encoding UNICODE
select id, data from i18ntest;
\encoding LATIN1
select id, data from i18ntest;
\encoding LATIN9
select id, data from i18ntest;
-- drop table i18ntest;
-- drop database i18ntest;
No file was uploaded with this report