Re: Encoding and i18n - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Encoding and i18n
Date
Msg-id 20071006174313.GF7190@alvh.no-ip.org
Whole thread Raw
In response to Re: Encoding and i18n  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Encoding and i18n
List pgsql-hackers
Andrew Dunstan wrote:
>
>
> Alvaro Herrera wrote:
>>> Actually I was thinking about things like formatting.c which take 
>>> localized
>>> strings and return them as data which can end up in the database. If 
>>> they're
>>> in the wrong encoding then they'll be invalidly encoded strings in the
>>> database.
>>
>> Oh, I didn't think of that.  Let me see if I can get an invalid string
>> into the database that way.
>
> I was quite certain when we closed most of these holes recently that we 
> hadn't caught them all, so this wouldn't surprise me in the least.

It seems to work correctly:

alvherre=# drop table week;
DROP TABLE
alvherre=# create table week (a text);
CREATE TABLE
alvherre=# \encoding utf8
alvherre=# insert into week  select to_char(now()-'3 days'::interval, 'tmday');
INSERT 0 1
alvherre=# \encoding latin1
alvherre=# insert into week  select to_char(now()-'3 days'::interval, 'tmday');
INSERT 0 1
alvherre=# select * from week;    a     
-----------miércolesmiércoles
(2 lignes)

I tried on both a UTF8 and Latin1 terminal and it works OK in all cases.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Polymorphic arguments and composite types
Next
From: Simon Riggs
Date:
Subject: Re: Polymorphic arguments and composite types