pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedabout encoding
4+ messages / 3 participants
[nested] [flat]
* about encoding
@ 2012-03-29 03:00 superman0920 <superman0920@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: superman0920 @ 2012-03-29 03:00 UTC (permalink / raw)
To: pgsql-admin
hello
i want to insert a report to postgresql,the report contain something Chinese characters and the postgresql is utf-8.
the response from db is this:
ERROR: invalid byte sequence for encoding "UTF8": 0xb1
how can i fix it ?
thx
superman0920
^ permalink raw reply [nested|flat] 4+ messages in thread
* about encoding
@ 2012-03-29 03:22 superman0920 <superman0920@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: superman0920 @ 2012-03-29 03:22 UTC (permalink / raw)
To: pgsql-admin
hello
i want to insert a report to postgresql,the report contain something Chinese characters and the postgresql is utf-8.
the response from db is this:
ERROR: invalid byte sequence for encoding "UTF8": 0xb1
how can i fix it ?
thx
superman0920
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: about encoding
@ 2012-03-29 14:37 Kevin Grittner <Kevin.Grittner@wicourts.gov>
parent: superman0920 <superman0920@gmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Grittner @ 2012-03-29 14:37 UTC (permalink / raw)
To: superman0920 <superman0920@gmail.com>; pgsql-admin
superman0920 <superman0920@gmail.com> wrote:
> i want to insert a report to postgresql,the report contain
> something Chinese characters and the postgresql is utf-8.
>
> the response from db is this:
> ERROR: invalid byte sequence for encoding "UTF8": 0xb1
That's not a valid byte sequence for a character under the UTF8
character encoding scheme. You said that PostgreSQL is using utf-8,
but what encoding is used for the report? Is your client connecting
using the character encoding scheme used by the report?
-Kevin
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: about encoding
@ 2012-04-02 15:55 Steve Crawford <scrawford@pinpointresearch.com>
parent: superman0920 <superman0920@gmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: Steve Crawford @ 2012-04-02 15:55 UTC (permalink / raw)
To: superman0920 <superman0920@gmail.com>; +Cc: pgsql-admin
On 03/28/2012 08:00 PM, superman0920 wrote:
> hello
> i want to insert a report to postgresql,the report contain something
> Chinese characters and the postgresql is utf-8.
> the response from db is this:
> ERROR: invalid byte sequence for encoding "UTF8": 0xb1
> how can i fix it ?
>
<snark>Remove the bad character??</snark>
You need to provide a bit more information, but the likely cause is that
the data you are inserting is not UTF8 encoded. Check the system that is
generating the data you wish to insert and make sure it is set to write
its output as UTF8.
If you cannot set it to write UTF8, then you need to determine what
character-set it is using and tell PostgreSQL to use that. See "SET
client_encoding..." Note that UTF8 is the character set that PostgreSQL
is using internally but you can read and write other sets through the
client_encoding setting.
Also be aware that UTF8 is just one of many ways of encoding the various
Unicode code-points. People sometimes conversationally interchange
Unicode and UTF8 but they are not the same. Make sure that the data you
are receiving is specifically UTF8 and not just some unknown Unicode
encoding.
If you are still stuck after checking/fixing the above you could
actually have bad data in your input or, possibly, an incorrect
byte-order issue though that is unlikely in most situations.
Cheers,
Steve
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2012-04-02 15:55 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-03-29 03:00 about encoding superman0920 <superman0920@gmail.com>
2012-04-02 15:55 ` Steve Crawford <scrawford@pinpointresearch.com>
2012-03-29 03:22 about encoding superman0920 <superman0920@gmail.com>
2012-03-29 14:37 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
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