Invalid Byte Sequence

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
icecrew
Posts: 12
Joined: Thu 28 Feb 2008 22:26

Invalid Byte Sequence

Post by icecrew » Fri 29 Feb 2008 12:45

Hi guys,

I am not sure if this is the right forum but here goes ...

I am moving data from SQL Server to PostgreSQL. The table in SQL Server is slightly different in structure to the one in PostgreSQL. To do the move I perform the following:

1. Fill Dataset1 with the contents of the SQL Server table.

2. Move the data from each field in the table in Dataset1 to the corresponding field in the table in Dataset2.

3. Use the Update method of Dataset2 to populate the PostreSQL database.

The operation runs smoothly at first but then some records are causing this error message: invalid byte sequence for encoding "UTF8": 0x00. The SQL Server database uses the SQL_Latin1_General_CP1_CI_AS collation. PostgreSQL uses UTF8 encoding. I'm guessing this could be the root of my problem.

How do I get past this error?

Thanks.

Alexey.mdr
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Post by Alexey.mdr » Fri 29 Feb 2008 13:50

I suppose, you have got incorrect data in the second DataSet.
Try to check if the values are valid (e.g. in the DataGridView).
Try locating the wrong values.
Probably you will just delete the char 0x00 in the destination DataSet.

icecrew
Posts: 12
Joined: Thu 28 Feb 2008 22:26

RE: Invalid Byte Sequence

Post by icecrew » Fri 29 Feb 2008 17:42

OK, after a couple hours of character hunting (it's a large table) I was finally able to isolate the field. A few minutes later, I was able to isolate the offending 0x00 character. Peace has returned to the village :D

Thanks for the input ...

Alexey.mdr
Posts: 729
Joined: Thu 13 Dec 2007 10:24

Post by Alexey.mdr » Mon 03 Mar 2008 11:36

We are glad the problem is solved now.
Feel free to contact us.

Post Reply