Gentoo Forums
Gentoo Forums
Quick Search: in
PostgreSQL broken by UTF-8 [SOLVED]
View unanswered posts
View posts from last 24 hours

rackathon
 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
sigra
n00b
n00b


Joined: 03 Feb 2006
Posts: 47

PostPosted: Tue May 06, 2008 8:48 am    Post subject: PostgreSQL broken by UTF-8 [SOLVED] Reply with quote

I changed my locale to sv_SE.UTF-8 and now PostgreSQL is broken. I can not use the tables that have local characters in their names. If I just connect to a database with psql and type ");" I get:
$ psql prov
Välkommen till psql 8.0.15, PostgreSQLs interaktiva terminal.

Skriv: \copyright för upphovsrättsinformation
\h för hjälp om SQL-kommandon
\? för hjälp om psql-kommandon
\g eller avsluta med semikolon för att köra en fråga
\q för att avsluta

prov=# );
FEL: syntaxfel vid eller n�ra ")" at character 1
RAD 1: );
^
prov=#


Note how characters like åäö are shown correctly in the initial information text, but not in the error message. What should I do to make PostgreSQL behave?

Edited:
Executing \encoding utf8 first of all in psql seems to alleviate the problem. To make it permanent I had to do mkdir -p /etc/postgresql;echo "\\\encoding utf8">>/etc/posgresql/psqlrc. The error messsage is printed correctly and tables seem to be mostly usable. But unfortunately tab completion is not working right.
Back to top
View user's profile Send private message
leifbk
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jan 2004
Posts: 149
Location: Oslo, Norway

PostPosted: Wed May 21, 2008 8:13 am    Post subject: Reply with quote

What kind of encoding did you use when you ran initdb? By default, it will use your LC_ALL setting. See also http://www.postgresql.org/docs/8.2/interactive/locale.html.

For my own part, I created a file /etc/env.d/02locale:

Code:
LANG="nb_NO.UTF-8"
LC_ALL="nb_NO.UTF-8"


And Norwegian characters work like a charm :)

In any case, I wouldn't recommend using national characters in table names or anything but text strings...
_________________
I don't have a hardware problem! I can quit buying hardware whenever I want!
Me And My Database :: Geek Genealogy
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum