Re: Encoding and i18n

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Encoding and i18n
Date: 2007-10-06 17:43:13
Message-ID: 20071006174313.GF7190@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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ércoles
mié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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2007-10-06 17:48:47 Re: Polymorphic arguments and composite types
Previous Message Stephan Szabo 2007-10-06 17:15:40 Re: Polymorphic arguments and composite types