Page 1 of 1

Invalid Byte Sequence

Posted: Fri 29 Feb 2008 12:45
by icecrew
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.

Posted: Fri 29 Feb 2008 13:50
by Alexey.mdr
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.

RE: Invalid Byte Sequence

Posted: Fri 29 Feb 2008 17:42
by icecrew
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 ...

Posted: Mon 03 Mar 2008 11:36
by Alexey.mdr
We are glad the problem is solved now.
Feel free to contact us.