pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedERROR: invalid byte sequence for encoding "UTF8": 0x92
6+ messages / 6 participants
[nested] [flat]
* ERROR: invalid byte sequence for encoding "UTF8": 0x92
@ 2007-03-20 19:34 Karthikeyan Sundaram <skarthi98@hotmail.com>
2007-03-20 20:03 ` Re: ERROR: invalid byte sequence for encoding "UTF8": 0x92 Ivo Rossacher <rossacher@bluewin.ch>
2007-03-20 20:06 ` Re: [SQL] ERROR: invalid byte sequence for encoding "UTF8": 0x92 Claus Guttesen <kometen@gmail.com>
0 siblings, 2 replies; 6+ messages in thread
From: Karthikeyan Sundaram @ 2007-03-20 19:34 UTC (permalink / raw)
To: pgsql-admin; pgsql-sql@postgresql.org
Hi,
I am using postgres 8.2.3. I have recently converted my database from
sql-ascii to UTF8. I have a portal which calls a perl program to insert the
data into the database.
While inserting, I am getting an error message
DBD::Pg::st execute failed: ERROR: invalid byte sequence for encoding
"UTF8": 0x92
[for Statement "INSERT INTO longdescs (bug_id, who, bug_when, thetext,
isprivate)
How can I set the client encoding in perl. Can somebody help me?
Regards
skarthi
_________________________________________________________________
Get a FREE Web site, company branded e-mail and more from Microsoft Office
Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ERROR: invalid byte sequence for encoding "UTF8": 0x92
2007-03-20 19:34 ERROR: invalid byte sequence for encoding "UTF8": 0x92 Karthikeyan Sundaram <skarthi98@hotmail.com>
@ 2007-03-20 20:03 ` Ivo Rossacher <rossacher@bluewin.ch>
1 sibling, 0 replies; 6+ messages in thread
From: Ivo Rossacher @ 2007-03-20 20:03 UTC (permalink / raw)
To: pgsql-admin
Am Dienstag, 20. März 2007 20:34 schrieb Karthikeyan Sundaram:
> Hi,
>
> I am using postgres 8.2.3. I have recently converted my database from
> sql-ascii to UTF8. I have a portal which calls a perl program to insert
> the data into the database.
>
> While inserting, I am getting an error message
>
> DBD::Pg::st execute failed: ERROR: invalid byte sequence for encoding
> "UTF8": 0x92
> [for Statement "INSERT INTO longdescs (bug_id, who, bug_when, thetext,
> isprivate)
>
>
> How can I set the client encoding in perl. Can somebody help me?
>
> Regards
> skarthi
After the connection is done send set client_encoding to '<Encoding Perl is
using>' to the server. The server then will convert the strings back and
forward for you.
Se manual chapter 21.2 Character Set Support for more details.
Best regards
Ivo
>
> _________________________________________________________________
> Get a FREE Web site, company branded e-mail and more from Microsoft Office
> Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [SQL] ERROR: invalid byte sequence for encoding "UTF8": 0x92
2007-03-20 19:34 ERROR: invalid byte sequence for encoding "UTF8": 0x92 Karthikeyan Sundaram <skarthi98@hotmail.com>
@ 2007-03-20 20:06 ` Claus Guttesen <kometen@gmail.com>
2007-03-21 03:32 ` Re: [SQL] ERROR: invalid byte sequence for encoding "UTF8": 0x92 Michael Fuhr <mike@fuhr.org>
1 sibling, 1 reply; 6+ messages in thread
From: Claus Guttesen @ 2007-03-20 20:06 UTC (permalink / raw)
To: Karthikeyan Sundaram <skarthi98@hotmail.com>; +Cc: pgsql-admin; pgsql-sql@postgresql.org
> I am using postgres 8.2.3. I have recently converted my database from
> sql-ascii to UTF8. I have a portal which calls a perl program to insert the
> data into the database.
>
> While inserting, I am getting an error message
>
> DBD::Pg::st execute failed: ERROR: invalid byte sequence for encoding
> "UTF8": 0x92
> [for Statement "INSERT INTO longdescs (bug_id, who, bug_when, thetext,
> isprivate)
Try to modify client_encoding in postgresql.conf to utf8 and restart your db.
regards
Claus
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [SQL] ERROR: invalid byte sequence for encoding "UTF8": 0x92
2007-03-20 19:34 ERROR: invalid byte sequence for encoding "UTF8": 0x92 Karthikeyan Sundaram <skarthi98@hotmail.com>
2007-03-20 20:06 ` Re: [SQL] ERROR: invalid byte sequence for encoding "UTF8": 0x92 Claus Guttesen <kometen@gmail.com>
@ 2007-03-21 03:32 ` Michael Fuhr <mike@fuhr.org>
0 siblings, 0 replies; 6+ messages in thread
From: Michael Fuhr @ 2007-03-21 03:32 UTC (permalink / raw)
To: Claus Guttesen <kometen@gmail.com>; +Cc: Karthikeyan Sundaram <skarthi98@hotmail.com>; pgsql-admin; pgsql-sql@postgresql.org
On Tue, Mar 20, 2007 at 09:06:25PM +0100, Claus Guttesen wrote:
> >DBD::Pg::st execute failed: ERROR: invalid byte sequence for encoding
> >"UTF8": 0x92
> >[for Statement "INSERT INTO longdescs (bug_id, who, bug_when, thetext,
> >isprivate)
>
> Try to modify client_encoding in postgresql.conf to utf8 and restart your
> db.
The data is apparently not UTF-8 so client_encoding needs to be set
to something else. 0x92 is a hint that the encoding might be
Windows-1252 or Windows-1250 since that byte represents the right
single quotation mark in those encodings; that's a common character
in data that originated in Windows. Also, client_encoding can be set
by the client without having to restart the backend.
--
Michael Fuhr
^ permalink raw reply [nested|flat] 6+ messages in thread
* ERROR: invalid byte sequence for encoding "UTF8": 0x00
@ 2017-11-07 01:10 PropAAS DBA <dba@propaas.com>
2017-11-07 07:41 ` Re: ERROR: invalid byte sequence for encoding "UTF8": 0x00 Laurenz Albe <laurenz.albe@cybertec.at>
0 siblings, 1 reply; 6+ messages in thread
From: PropAAS DBA @ 2017-11-07 01:10 UTC (permalink / raw)
To: pgsql-admin
All;
we are doing an oracle to Postgresql conversion, lots and lots of the
oracle columns throw this error:
ERROR: invalid byte sequence for encoding "UTF8": 0x00
CONTEXT: converting column [colname] for foreign table scan of
[tablename] row xxx
We are using the ora_fdw oracle foreign data wrapper extension to
perform the data conversion, we create the foreign tables via the
"IMPORT FOREIGN SCHEMA" option, then do an insert in [postgres_table]
select * from [ora_fdw_table]
I've tried a number of fixes but they all seem to replace the data for
ALL rows instead of just the broken ones.
For example:
select id, cname from ora_fdw_schema.cust_names
ERROR: invalid byte sequence for encoding "UTF8": 0x00
CONTEXT: converting column cname for foreign table scan of
ora_fdw_schema.cust_names, row 122
If I use replace then ALL rows are NULL:
select id, replace(cname,'',NULL) from ora_fdw_schema.cust_names
id | replace
---------+----------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
Same thing if I use translate:
select id, translate(cname,'',NULL) from ora_fdw_schema.cust_names
Help?
Thanks in advance
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ERROR: invalid byte sequence for encoding "UTF8": 0x00
2017-11-07 01:10 ERROR: invalid byte sequence for encoding "UTF8": 0x00 PropAAS DBA <dba@propaas.com>
@ 2017-11-07 07:41 ` Laurenz Albe <laurenz.albe@cybertec.at>
0 siblings, 0 replies; 6+ messages in thread
From: Laurenz Albe @ 2017-11-07 07:41 UTC (permalink / raw)
To: PropAAS DBA <dba@propaas.com>; pgsql-admin
PropAAS DBA wrote:
> All;
That's me :^)
> we are doing an oracle to Postgresql conversion, lots and lots of the
> oracle columns throw this error:
>
> ERROR: invalid byte sequence for encoding "UTF8": 0x00
>
> CONTEXT: converting column [colname] for foreign table scan of
> [tablename] row xxx
>
> We are using the ora_fdw oracle foreign data wrapper extension to
> perform the data conversion, we create the foreign tables via the
> "IMPORT FOREIGN SCHEMA" option, then do an insert in [postgres_table]
> select * from [ora_fdw_table]
>
> I've tried a number of fixes but they all seem to replace the data for
> ALL rows instead of just the broken ones.
>
>
> For example:
>
> select id, cname from ora_fdw_schema.cust_names
>
> ERROR: invalid byte sequence for encoding "UTF8": 0x00
>
> CONTEXT: converting column cname for foreign table scan of
> ora_fdw_schema.cust_names, row 122
The reason is that there are some zero bytes (ASCII NUL) in the Oracle
table. While these are allowed in Oracle, they are not allowed in PostgreSQL
because PostgreSQL regards zero bytes as string terminators.
That is why oracle_fdw will not allow you to transfer these data
to PostgreSQL.
> If I use replace then ALL rows are NULL:
Any attempt to fix the data on the PostgreSQL side is doomed.
The error message is thrown when the data are converted to PostgreSQL
string types, which is *before* you can manipulate them in PostgreSQL.
You'll have to fix the data on the Oracle side before you migrate
the database. Usually, such zero bytes in strings are introduced
into the Oracle table by mistake, and no harm is done in removing them.
Use a condition like
WHERE cname LIKE '%' || CHR(0) || '%'
in Oracle to spot the affected rows.
Yours,
Laurenz Albe
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2017-11-07 07:41 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-03-20 19:34 ERROR: invalid byte sequence for encoding "UTF8": 0x92 Karthikeyan Sundaram <skarthi98@hotmail.com>
2007-03-20 20:03 ` Ivo Rossacher <rossacher@bluewin.ch>
2007-03-20 20:06 ` Re: [SQL] ERROR: invalid byte sequence for encoding "UTF8": 0x92 Claus Guttesen <kometen@gmail.com>
2007-03-21 03:32 ` Re: [SQL] ERROR: invalid byte sequence for encoding "UTF8": 0x92 Michael Fuhr <mike@fuhr.org>
2017-11-07 01:10 ERROR: invalid byte sequence for encoding "UTF8": 0x00 PropAAS DBA <dba@propaas.com>
2017-11-07 07:41 ` Re: ERROR: invalid byte sequence for encoding "UTF8": 0x00 Laurenz Albe <laurenz.albe@cybertec.at>
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