Re: Migration error " invalid byte sequence for encoding "UTF8": 0xff " from mysql 5.5 to postgresql 9.1

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "John R Pierce *EXTERN*" <pierce(at)hogranch(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Migration error " invalid byte sequence for encoding "UTF8": 0xff " from mysql 5.5 to postgresql 9.1
Date: 2014-07-04 09:51:59
Message-ID: A737B7A37273E048B164557ADEF4A58B17D16E5D@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

John R Pierce wrote:
> On 7/4/2014 2:12 AM, sunpeng wrote:
>> Thank you, friend, I use --hex-blob :
>> mysqldump -v -nt --complete-insert=TRUE --compatible=postgresql
>> --default-character-set=utf8 --skip-add-locks --compact
>> --no-create-info --skip-quote-names --hex-blob -uroot -p test
>> videorecresult >dbdata.sql
>> to dump mysql data.
>> And replace blob data "0x...." into "E'\\xx....'" to load data into
>> postgresql.

> regardless of all that, 0xFF is not a valid UTF8 character code. perhaps
> you should store the data in a postgres BYTEA, or at least use character
> encoding SQLASCII (which is to say, no encoding, bytes in == bytes out.)

Exactly.
According to mysqldump's man page, the affected field must be
BINARY, VARBINARY, the BLOB types or BIT.
For these PostgreSQL's "bytea" would definitely be the correct data type,
and there wouldn't be any encoding problems with that.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2014-07-04 11:47:24 Re: Windows releases - Bundle OpenSSL includes and .libs in the installer?
Previous Message John R Pierce 2014-07-04 09:21:01 Re: Migration error " invalid byte sequence for encoding "UTF8": 0xff " from mysql 5.5 to postgresql 9.1