X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CBF905291F; Tue, 9 Aug 2005 14:18:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12381-06; Tue, 9 Aug 2005 17:18:42 +0000 (GMT) Received: from alvh.no-ip.org (200-85-218-206.bk4-dsl.surnet.cl [200.85.218.206]) by svr1.postgresql.org (Postfix) with ESMTP id 81B29528BE; Tue, 9 Aug 2005 14:18:41 -0300 (ADT) Received: by alvh.no-ip.org (Postfix, from userid 1000) id E6EF4C31DE8; Tue, 9 Aug 2005 13:18:53 -0400 (CLT) Date: Tue, 9 Aug 2005 13:18:53 -0400 From: Alvaro Herrera To: Joel Fradkin Cc: 'Tom Lane' , 'Salem Berhanu' , pgsql-admin@postgresql.org, pgsql-general@postgresql.org Subject: Re: [GENERAL] postgres & server encodings Message-ID: <20050809171853.GB21039@alvh.no-ip.org> Mail-Followup-To: Joel Fradkin , 'Tom Lane' , 'Salem Berhanu' , pgsql-admin@postgresql.org, pgsql-general@postgresql.org References: <16705.1123603167@sss.pgh.pa.us> <001601c59d03$4f107af0$797ba8c0@jfradkin> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <001601c59d03$4f107af0$797ba8c0@jfradkin> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.832 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200508/111 X-Sequence-Number: 18430 On Tue, Aug 09, 2005 at 12:56:37PM -0400, Joel Fradkin wrote: > Not that I am an expert or anything, but my initial data base was SQLASCII > and I did have to convert it to Unicode. > My reasons were we store French characters in our database and the newer > odbc driver was not displaying them correctly coming from SQLASCII, but was > from UNICODE. > I also think that it can affect functions like length and upper, but Tom > knows a ton more then me about this stuff. > > I did my initial conversion on 7.4 and the odbc driver at that time had no > issues with SQLASCII displaying the French, but I think in 8.0.1 I started > seeing an issue. The latest version of the driver 8.0.4 seems to be working > well (only up a little over 24 hours thus far). A conversion will work fine assuming the data is all encoded using the same encoding. So if it's all utf8 ("Unicode") already, you can import it verbatim into a UTF8 database and it will work fine. If it's all Latin-1, you can import into a UTF-8 db using a client_encoding=latin1 during import, or verbatim to a Latin-1 database, and it will also work fine. (You of course are expected to be able to figure out what encoding is the data really in.) The problem only shows up when you have mixed data -- say, you have two applications, one website in PHP which inserts data in Latin-1, and a Windows app which inserts in UTF-8. In this case your data will be a mess to fix, and there's no way a single conversion will get it right. You will have to manually separate the parts that are UTF8 from the Latin1, and import them separately. Not a position I'd like to be in. -- Alvaro Herrera () "Coge la flor que hoy nace alegre, ufana. ¿Quién sabe si nacera otra mañana?"