1

I am having a problem with my Postgresql console. I can't write characters with accents. For example

á é í ó ú

When I write the character simply does not appear.

I have installed Postgresql 9.4 on debian server.

Can anybody help me?

daronwolff
  • 1,994
  • 21
  • 18
  • 1. In psql type `\l` that will list your databases with their encodings and collation. What is it and what did you expect it to be? 2. Can you type those characters at your console before you login to psql? – Richard Huxton Apr 07 '16 at 19:49
  • The database has Encoding; UTF8 : collate en_US.UTF-8 – daronwolff Apr 07 '16 at 22:07
  • And can you type those characters in a console (just at the command-line)? Also - do you see © if you run the query `SELECT chr(169);` – Richard Huxton Apr 07 '16 at 22:13
  • Yes, i can. When i run SELECT chr(169); i am getting a © – daronwolff Apr 07 '16 at 23:41
  • It sounds like everything is fine. I'll add more in an "answer" but it will only be more troubleshooting. – Richard Huxton Apr 08 '16 at 15:39
  • 1
    Take a look at [this response](http://stackoverflow.com/a/24825481/5969411) to a different question. It may help you. I can post it as an answer if required. – ManoDestra Apr 08 '16 at 15:52
  • Which operating system are you using? This has nothing to do with `psql` but everything with the operating system's character set support –  Apr 08 '16 at 16:37
  • I have a Linux Debian as Server – daronwolff Apr 08 '16 at 17:15

1 Answers1

1

OK - not really an answer, but...

You say that you can type the characters fine before you login to psql, and that SELECT chr(169) gives you a "©". So - we have a puzzle. Something between your keyboard/screen and psql on the server is causing problems.

Things we can try:

  1. Create a test.sql file which creates a test table and inserts some accented characters into it. Make sure that the file is in utf-8 encoding (most text editors will let you see/set this).
  2. Run your script from psql with \i /path/to/test.sql and see what results you get.
  3. Select from your test table again, but first do \o output.sql which will save the output into that file.

If everything is good, then the database end of things is handling everything just fine. If the screen looks funny but the file is ok then it's something to do with your terminal settings.

Richard Huxton
  • 21,516
  • 3
  • 39
  • 51
  • Hey!! It worked!! I can not understand why i cant type with accents but importing the SQL file is working!! Many thanks! – daronwolff Apr 08 '16 at 16:22
  • 1
    OK - so it's something outside the DB. If you ssh into the server, check your local machine is sending utf-8 properly. If not, it will be something odd in your terminal settings. – Richard Huxton Apr 08 '16 at 20:18