Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

At work, I need to connect to databases, and these database contain fields that hold Chinese, Russian, Spanish, Japanese, etc. characters. When pulling them up in my terminal, I get question marks. I know there is a way to show the actual characters instead of question marks, but how?

:~$ locale on the remote results in:

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

:~$ locale on the clint results in:

LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Check locale to make sure the server side is using UTF-8 or change locale to UTF-8. Then configure your SSH client to use UTF-8 (not ISO-8859-1). For example, if using Putty, we have to set Putty's character set:

Putty: Window->Translation->Remote character set: UTF-8

enter image description here

Otherwise, it will use ISO-8859-1. A Mac problem resolved.

Alternatively, running this command while connected to a mysql database will output UTF-8 characters from mysql queries.

set character_set_results=utf8, character_set_client=utf8, character_set_connection=utf8;
share|improve this answer
    
So it is using UTF-8, and that doesn't work. so I ran these: sudo cp /usr/share/i18n/SUPPORTED /var/lib/locales/supported.d/local sudo locale-gen and that didn't work either. –  Ryan Naddy Jan 3 '13 at 20:13
    
@RyanNaddy Just type locale. If returns that it is using UTF-8, good! Now the client side must be configured to use UTF-8. Many do not do this without explicit configuration. What's your client? –  user8290 Jan 3 '13 at 20:20
    
They both are UTF-8. Please see updated question. –  Ryan Naddy Jan 3 '13 at 20:23
    
It does not matter that the client system is using UTF-8 with the locale command. The SSH client itself probably needs to know to USE UTF-8. (Most need this.) Also: at a MySQL prompt: mysql> set character_set_results=utf8, character_set_client=utf8, character_set_connection=utf8; –  user8290 Jan 3 '13 at 20:42
    
this command fixed it: set character_set_results=utf8, character_set_client=utf8, character_set_connection=utf8; –  Ryan Naddy Jan 3 '13 at 20:59
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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