Thread: inserting non-ascii characters

inserting non-ascii characters

From
"Peter Schonefeld"
Date:
Hi,

I'm having trouble finding out how to add non-ascii chars into the database
from c#. 'ERROR: 22021: invalid byte sequence for encoding "UNICODE": 0xfc '
is the error I get when attempting to add something like "müller" into a
varchar field from my program.

Thanks
Pete


Re: inserting non-ascii characters

From
Andreas Seltenreich
Date:
Peter Schonefeld schrob:

> I'm having trouble finding out how to add non-ascii chars into the database
> from c#. 'ERROR: 22021: invalid byte sequence for encoding "UNICODE": 0xfc '
> is the error I get when attempting to add something like "müller" into a
> varchar field from my program.

I guess your client_encoding does not match the encoding of your data.
If the 0xfc is the "ü" in "müller", then your data is probably encoded
as latin-1 / iso-8859-1.

   set client_encoding to 'iso-8859-1';

before your statements should set up proper conversion.

HTH
Andreas
--

Re: inserting non-ascii characters

From
"Peter Schonefeld"
Date:
Hi Andreas,

Thanks for the fix!!

Cheers
Pete

> I guess your client_encoding does not match the encoding of your data.
> If the 0xfc is the "ü" in "müller", then your data is probably encoded
> as latin-1 / iso-8859-1.
>
>    set client_encoding to 'iso-8859-1';
>
> before your statements should set up proper conversion.
>
> HTH
> Andreas
> --