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 6ECE23A53E0 for ; Wed, 12 Jan 2005 08:29:34 +0000 (GMT) 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 69166-09 for ; Wed, 12 Jan 2005 08:29:26 +0000 (GMT) Received: from millenium.mst.co.jp (millenium.mst.co.jp [210.251.240.193]) by svr1.postgresql.org (Postfix) with ESMTP id 8A8663A5983 for ; Wed, 12 Jan 2005 08:29:25 +0000 (GMT) Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id j0C8T8Q26985 for ; Wed, 12 Jan 2005 17:29:08 +0900 Message-ID: <001101c4f881$2c1af3d0$7201a8c0@mst1x5r347kymb> From: "Iain" To: Subject: How to fix bad multibyte data? Date: Wed, 12 Jan 2005 17:31:49 +0900 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-2022-jp"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/83 X-Sequence-Number: 15942 Hi All, I have a v7.1 database whose encoding is EUC_JP and I'm trying to get it into a v7.4 database whose encoding is also EUC_JP. Unfortunately it seems that 7.4 is much stricter about it's multibyte data then 7.1 was because attempts to restore into the 7.4 db result in "Invalid byte sequence for encoding"EUC_JP": 0x8e' errors. There is no doubt that the data in the 7.1 database is bad, though I'm not sure exactly how it got that way (the data was loaded by a C program from CSV file). Anyway, I can dump/restore on 7.1 ok. and I can restore into a 7.4 DB with the encoding set to SQL_ASCII but that isn't really what we want. I'm thinking that I may have to put the dump file through some kind of filter that will at least ensure that the data is valid EUC_JP, even if it mangles the data a little by dropping the invalid bytes. The question is, how would one go about this? I think a perl script might do the job (I'm not familiar with perl at all though), but there might be other ways... so before I go off down that path, I'm wondering if anyone has any suggestions. Regards Iain