Bug #837: Unable to use LATIN9 (=ISO-8859-15) encoding

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #837: Unable to use LATIN9 (=ISO-8859-15) encoding
Date: 2002-12-05 15:22:18
Message-ID: 20021205152218.342BC475CEE@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Steve Haslam (araqnid(at)debian(dot)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 as UNICODE. However, if I attempt to use the LATIN9 encoding, I get erroneous results. I am using PostgreSQL 7.3 from Debian unstable (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, when I 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 LATIN9 and 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 does not 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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2002-12-05 19:58:32 Re: Cannot create view with subquery and join clause
Previous Message Robert Osowiecki 2002-12-05 13:28:10 Cannot create view with subquery and join clause