Re: not valid character for Unicode

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Adam Witney <awitney(at)sgul(dot)ac(dot)uk>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: not valid character for Unicode
Date: 2006-06-09 15:25:02
Message-ID: 20060609152502.GD26418@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jun 09, 2006 at 04:17:50PM +0100, Adam Witney wrote:
> > It's a valid unicode character, it's just you havn't encoded it in
> > unicode. It's probably in Latin-1. In that case, you need to specify it
> > in the client encoding...
>
> Hi Martijn,
>
> thanks for your quick response.
>
> Ok i am a bit confused by all this encoding stuff... i don't really know
> how to encode it in unicode? this is a text string that is extracted
> from a text file, i just put it in an INSERT statement.

The database will do the encoding for you, you just have to tell it
what encoding it is. By default it assumes you're using the same
encoding as the backend. So:

# set client_encoding='latin1';

-- Now all my strings are considered to be in latin1

# set client_encoding='sjis';

-- Now my strings are SJIS

# set client_encoding='unicode';

-- Now my strings need to be utf-8

> I have to replace fields with this in it with a valid string that will
> load into 8.1, do you know who i would do the conversion?

The database will do it for you. Note that the client encoding affects
input *and* output. So if you set it to latin1, the database will
convert all strings to latin1 before sending them to you...

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A.M. 2006-06-09 15:25:43 Re: not valid character for Unicode
Previous Message Martijn van Oosterhout 2006-06-09 15:20:46 Re: Fabian Pascal and RDBMS deficiencies in fully implementing the relational model