Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a my sql server running on a debian linux hosted at linode.com some of my data has hebrew characters in it.

I am connecting to the server via putty ssh on windows 7. when I run the sql admin console (mysql) and execute a select query all hebrew characters are displayed as '?'.

I am not even sure where the problem is, but I guess its either the mysql console or putty that is loosing the hebrew.

the data itself is o.k. (I know this because it is also accessed via a web page where it displays just fine).

any ideas on what I should do to enable hebrew for this scenario?

Thanks.

share|improve this question
    
"The data itself is o.k." - just because it looks ok, doesn't mean that it is, see my answer below for more help. –  Lee Hambley Mar 8 '11 at 12:59
    
true. but it IS indeed o.k. :) –  epeleg Mar 9 '11 at 15:39
add comment

1 Answer

up vote 0 down vote accepted

Character encodings are a little changeling, it could be that your data (which, after all is all just binary).

You should first check your database's encoding, and the table's individual encoding. The encoding referrs to the internal storage… a good example might be that you're storing ISO-8859-1 so the database expects only ISO-8859-1, but if some of the data is in Hebrew, these characters aren't valid in ISO-8859-1.. but if the clients putting the data in, and getting it out are using ISO-8859-8 (Hebrew), it will mostly appear to work.

Here is a guide from MySQL on the topic.

I would recommend (where possible) that you use UTF-8, there's a number of reasons, but please, please do not blindly alter your databases encoding, as this doesn't re-encode the data, but simply informs MySQL that it should be treated like UTF8. (Which will corrupt your data, if the source is ISO-8859-1 or ISO-8859-8. here is another a primer on character encodings, and you'd be well served to give it the once over. "The bare minimum any software engineer should know about Unicode"

Further to that, your terminal (your bash session), terminal emulator (putty) and db console (mysql) all have to know what encoding they are dealing with… it's best to tell them UTF-8… and then work with UTF-8 data.

share|improve this answer
    
all the tables on my DB where created using CHARSET=utf8. –  epeleg Mar 8 '11 at 21:36
    
what would be the next thing to check assuming the actual data is o.k. ? The Q was not what are character encodings, I am well aware of what they are. the real Q is does mysql admin console have some secrect parameter to tell it to use utf8 ? and the same for putty. –  epeleg Mar 8 '11 at 21:38
    
having actually stated my Q again as I did I went to look at the parameters mysql has and indeed --default-cahracter-set=utf fixed things up for me. thanks. –  epeleg Mar 8 '11 at 21:42
    
Great, happy that you got a look… sorry for the "back to school" primer on Charsets, but it's worth crossing the Ts and dotting the Is on this stuff! Thanks for the accept –  Lee Hambley Mar 9 '11 at 9:23
add 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.