Special charaters

Lists: pgsql-general
From: ANKITBHATNAGAR <abhatnagar(at)vantage(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Special charaters
Date: 2009-03-19 16:53:31
Message-ID: 22604452.post@talk.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


Hi
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?

Ankit
--
View this message in context: http://www.nabble.com/Special-charaters-tp22604452p22604452.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


From: ries van Twisk <pg(at)rvt(dot)dds(dot)nl>
To: ANKITBHATNAGAR <abhatnagar(at)vantage(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Special charaters
Date: 2009-03-19 17:28:11
Message-ID: 163F6838-8D13-499F-ABAA-DA1D60760D0F@rvt.dds.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


On Mar 19, 2009, at 11:53 AM, ANKITBHATNAGAR wrote:

>
> Hi
> 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.

Ries
>
> Ankit


From: Michael Higgins <linux(at)evolone(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Special charaters
Date: 2009-03-19 22:28:35
Message-ID: 20090319152835.5030c575@lappy.evolone.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Thu, 19 Mar 2009 12:28:11 -0500
ries van Twisk <pg(at)rvt(dot)dds(dot)nl> wrote:

>
> On Mar 19, 2009, at 11:53 AM, ANKITBHATNAGAR wrote:
>
> >
> > Hi
> > 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.)

Cheers,

--
|\ /| | | ~ ~
| \/ | |---| `|` ?
| |ichael | |iggins \^ /
michael.higgins[at]evolone[dot]org


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Michael Higgins <linux(at)evolone(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Special charaters
Date: 2009-03-19 23:42:36
Message-ID: 20090319234236.GS8874@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Michael Higgins wrote:
> On Thu, 19 Mar 2009 12:28:11 -0500
> ries van Twisk <pg(at)rvt(dot)dds(dot)nl> wrote:
>
> >
> > On Mar 19, 2009, at 11:53 AM, ANKITBHATNAGAR wrote:
> >
> > >
> > > Hi
> > > 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.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


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
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