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 ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings