pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Iain <iain@mst.co.jp>
To: pgsql-admin@postgresql.org
Subject: How to fix bad multibyte data?
Date: Wed, 12 Jan 2005 17:31:49 +0900
Message-ID: <001101c4f881$2c1af3d0$7201a8c0@mst1x5r347kymb> (raw)

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





Message-ID: <001101c4f881$2c1af3d0$7201a8c0@mst1x5r347kymb>
Permalink:  ../001101c4f881$2c1af3d0$7201a8c0@mst1x5r347kymb/
Also on:    postgresql.org/message-id/001101c4f881$2c1af3d0$7201a8c0@mst1x5r347kymb

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: iain@mst.co.jp
  Subject: Re: How to fix bad multibyte data?
  In-Reply-To: <001101c4f881$2c1af3d0$7201a8c0@mst1x5r347kymb>
  References: <001101c4f881$2c1af3d0$7201a8c0@mst1x5r347kymb>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox