X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A73D5537FB for ; Sun, 15 May 2005 16:48:54 -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 63655-10 for ; Sun, 15 May 2005 19:48:50 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id AE06453786 for ; Sun, 15 May 2005 16:48:45 -0300 (ADT) Received: (qmail 25127 invoked from network); 15 May 2005 21:49:12 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 15 May 2005 21:49:12 +0200 To: "Rajesh Mallah" , pgsql-sql@postgresql.org Subject: Re: Significance of Database Encoding References: <20050515183829.53021.qmail@web31011.mail.mud.yahoo.com> Message-ID: Date: Sun, 15 May 2005 21:48:47 +0200 From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <20050515183829.53021.qmail@web31011.mail.mud.yahoo.com> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/107 X-Sequence-Number: 21420 > $ iconv -f US-ASCII -t UTF-8 < test.sql > out.sql > iconv: illegal input sequence at position 114500 > > Any ideas how the job can be accomplised reliably. > > Also my database may contain data in multiple encodings > like WINDOWS-1251 and WINDOWS-1256 in various places > as data has been inserted by different peoples using > different sources and client software. You could use a simple program like that (in Python): output = open( "unidump", "w" ) for line in open( "your dump" ): for encoding in "utf-8", "iso-8859-15", "whatever": try: output.write( unicode( line, encoding ).encode( "utf-8" )) break except UnicodeError: pass else: print "No suitable encoding for line..." I'd say this might work, if UTF-8 cannot absorb an apostrophe inside a multibit character. Can it ? Or you could do that to all your table using SELECTs but it's going to be painful...