| View previous topic :: View next topic |
| Author |
Message |
sigra n00b

Joined: 03 Feb 2006 Posts: 47
|
Posted: Tue May 06, 2008 8:48 am Post subject: PostgreSQL broken by UTF-8 [SOLVED] |
|
|
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 |
|
 |
leifbk Tux's lil' helper


Joined: 05 Jan 2004 Posts: 149 Location: Oslo, Norway
|
Posted: Wed May 21, 2008 8:13 am Post subject: |
|
|
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 |
|
 |
|
|
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
|
|