Re: How to insert non-english characters to the db? - Mailing list pgsql-novice

From Oliver Fromme
Subject Re: How to insert non-english characters to the db?
Date
Msg-id 200309081044.h88AiFhX081208@lurza.secnetix.de
Whole thread Raw
In response to How to insert non-english characters to the db?  (Andreas Fromm <Andreas.Fromm@physik.uni-erlangen.de>)
List 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

pgsql-novice by date:

Previous
From: "M. Bastin"
Date:
Subject: Re: How to insert non-english characters to the db?
Next
From: "Marcin Gil"
Date:
Subject: Postgresql does not see its files HEEEELP!