Re: How to insert non-english characters to the db?

From: Oliver Fromme <olli(at)lurza(dot)secnetix(dot)de>
To: Andreas(dot)Fromm(at)physik(dot)uni-erlangen(dot)de (Andreas Fromm)
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: How to insert non-english characters to the db?
Date: 2003-09-08 10:44:15
Message-ID: 200309081044.h88AiFhX081208@lurza.secnetix.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


Andreas Fromm wrote:
> I need to store strings with non-english characters in my DB. I created
> my db with unicode encoding, but am not able to insert data into it from
> psql nor pgaccess, which seems not to suport non english characters at
> all.

template1=# create table test ( testcol varchar ) ;
CREATE TABLE
template1=# insert into test values ( 'föö bär' );
INSERT 154068 1
template1=# select * from test;
testcol
---------
föö bär
(1 row)

template1=# \! env | egrep LC\|LANG
LC_CTYPE=de_DE.ISO8859-1

As you can see, psql supports non-English characters fine.
However, psql respects your locale settings. So, if your
locale settings are wrong, it will default to the standard
C / POSIX locale, i.e. US-ASCII.

The correct setting depends on your operating system. In
my case (FreeBSD), I set the environment variable LC_CTYPE
to "de_DE.ISO8859-1". On Solaris you can try "iso_8859_1".

Regards
Oliver

--
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"If you think C++ is not overly complicated, just what is a protected
abstract virtual base pure virtual private destructor, and when was the
last time you needed one?"
-- Tom Cargil, C++ Journal

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Marcin Gil 2003-09-08 12:46:56 Postgresql does not see its files HEEEELP!
Previous Message M. Bastin 2003-09-08 10:16:49 Re: How to insert non-english characters to the db?