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

From: sunpeng <bluevaley(at)gmail(dot)com>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: PostgreSQL general <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-02 15:42:16
Message-ID: CAOYKhLpXK_v+yYZLf9OMW1Up2rCozxeF3sFSYH0kgdGW+mC5MA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I‘v changed cmd (in win8) to encoding utf8 through chcp 65001, but error
still occurs.
And i use the following cmd to dump mysql data:
mysql> select Picture from personpicture where id =
'F2931306D1EE44ca82394CD3BC2404D4' into outfile "d:\\1.txt" ;
I got the ansi file, and use Ultraedit to see first 16 bytes:
FF D8 FF E0 5C 30 10 4A 46 49 46 5C 30 01 01 5C
It's different from mysql workbench to see:
FF D8 FF E0 00 10 4a 46 49 46 00 01 01 00 00 01

peng

On Tue, Jul 1, 2014 at 9:18 PM, Kevin Grittner <kgrittn(at)ymail(dot)com> wrote:

> sunpeng <bluevaley(at)gmail(dot)com> wrote:
>
> > load data to postgresql in cmd(encoding is GBK) is WIN8:
>
> > psql -h localhost -d test -U postgres < dbdata.sql
> >
> > I got the error:
> > ERROR: invalid byte sequence for encoding "UTF8": 0xff
>
> If the encoding is GBK then you will get errors (or incorrect
> characters) if it is read as UTF8. Try setting the environment
> variable PGCLIENTENCODING.
>
> http://www.postgresql.org/docs/9.1/static/app-psql.html
>
> --
> Kevin Grittner
> EDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2014-07-02 15:42:43 Re: How can I replace the year of the created_at column with the current year dynamically ?
Previous Message Gregory Haase 2014-07-02 15:06:15 Re: Question About Roles