1

I have a database that contains Spanish words in it. It contains words like sueño which have "special characters" in them. The MySQL database collation is set to utf-8-general-ci which supports foreign characters, so the database should be fine.

I have a python script that I run in the bash shell and it returns all words in the database, including the word sueño. The problem is that the bash shell doesn't display the word "sueño" properly. The n (with the tilde over it) is garbled when displayed in the bash shell. All other English words with no special characters are displayed properly.

Is there any way to enable foreign character (special character) support in the bash shell?

Thanks, PR

  • 1
    What terminal are you using? – Michael Hampton Dec 28 '12 at 19:49
  • 2
    Have you set your locale to one that supports Spanish? – fpmurphy Dec 29 '12 at 1:42
  • this may have to do with the encoding in your python script. if you had a simple example of the issue it would be easier to troubleshoot. – Drew Khoury Aug 12 '13 at 6:54
1

Can you show the output of the locale command?

example:

LANG=en_CA.UTF-8
LANGUAGE=en_CA:en
LC_CTYPE="en_CA.UTF-8"
LC_NUMERIC="en_CA.UTF-8"
LC_TIME="en_CA.UTF-8"
LC_COLLATE="en_CA.UTF-8"
LC_MONETARY="en_CA.UTF-8"
LC_MESSAGES="en_CA.UTF-8"
LC_PAPER="en_CA.UTF-8"
LC_NAME="en_CA.UTF-8"
LC_ADDRESS="en_CA.UTF-8"
LC_TELEPHONE="en_CA.UTF-8"
LC_MEASUREMENT="en_CA.UTF-8"
LC_IDENTIFICATION="en_CA.UTF-8"
LC_ALL=

If you change the LANG and LANGUAGE env variables you will be able to display those chars in your terminal. You can do a simple test like this:

LANG=en_CA.UTF-8; LANGUAGE=en_CA:en; echo ñ;

If that works you might want to permanently change your locale to a UTF-8 based one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.