Re: Special charaters

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Alvaro Herrera *EXTERN*" <alvherre(at)commandprompt(dot)com>, "Michael Higgins" <linux(at)evolone(dot)org>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Special charaters
Date: 2009-03-20 07:47:14
Message-ID: D960CB61B694CF459DCFB4B0128514C202FF64ED@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alvaro Herrera wrote:
> > > > This happens when I import csv file via my app into postgres.
> > > > The csv file has some “hello” from microsoft word 2003.
> > > > In postgres it appears as hello
> > > >
> > > > Could somebody help on this?
> > >
> > > Check your encodings.
> >
> > I doubt that's it, but I've been wrong before... I say, Google for
> > "smart quotes" and... good luck. (They don't belong to any encoding.)
>
> Well, they must exist at least on utf8, otherwise they couldn't have
> been pasted in the original message.

To be more precise, the two characters in question are UNICODE 201C and
201D. They exist only in UNICODE and Windows encodings.

Concerning the original problem:

- Figure out what the encoding of the CSV-File is. If the quotes are
one byte wide, it is a windows encoding, otherwise something UNICODE.
- Set the environment variable PGCLIENTENCODING to the value that belongs
to this encoding. There's a list in the documentation:
http://www.postgresql.org/docs/8.3/static/multibyte.html
- Make sure that the database is UTF-8.

Then e.g. import via psql's \copy should work fine.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tomasz Olszak 2009-03-20 08:17:46 Is there a method to Execute update in Pl/Pgsql function using rowtype variable
Previous Message Martijn van Oosterhout 2009-03-20 07:39:27 Re: Maximum transaction rate