Re: Re: Error When Trying to Use Npgsql to COPY into a PostgreSQL Database

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Altec103 <goldenbabbler(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Re: Error When Trying to Use Npgsql to COPY into a PostgreSQL Database
Date: 2014-06-24 23:24:06
Message-ID: 53AA0896.1080105@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 06/24/2014 01:37 PM, Altec103 wrote:
> Adrian, I actually figured it out. It was a really silly mistake - basically
> I was testing something earlier and edited my ODBC connection string. I was
> actually connecting to the wrong database and it was an empty database, so
> ODBCDataReader was trying to pull data from an empty table. Anyways, this is
> fixed. However, I have a new problem.
>
> I occasionally get an ERROR: 22021: invalid byte sequence for encoding
> "UTF8": 0x92 when using the COPY query and this stops the whole process. It
> occurs here in my code...
>
> var raw = Encoding.UTF8.GetBytes(string.Concat(dataEntry, "\n"));
> copy.CopyStream.Write(raw, 0, raw.Length);
>
> dataEntry is a string. I have tried a few things to try and remove any
> non-UTF8 characters from the string, but it has failed so far. Any ideas?
>
>

Some further digging found this:

https://github.com/npgsql/Npgsql/issues/124

Seems to address the same issue.

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2014-06-24 23:25:47 Re: Getting "cache lookup failed for aggregate" error
Previous Message Patrick Krecker 2014-06-24 22:54:06 Getting "cache lookup failed for aggregate" error