Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Non-Latin letters appear as "?????"

Status
Not open for further replies.

hpvic03

Technical User
Aug 2, 2006
89
Hello,

I have a mysql database setup and the character set is UTF-8. Non-Latin letters appear as question marks. How can I fix this without messing up my database?

Thanks in advance for your help!
 
Sorry. My crystal ball has broken down. MySQL is a database. It does not "show" things. AND, it makes a great difference what system displays your data.

Apart from that, the data may be entered wrong in your database. First problem is to find out if the stored data is right. The best way to find out is to use the mysqldump utility on a small table containing special characters.

Second, know what you are doing. This is a good first read:

Now, decide what encoding you use. You probably already have decided to use utf-8. But the problem may very well be that MySQL does not know.
By default, all sessions (connections) to mysql are latin-1 (iso-8859-1) encoded. This means that mysql will happily reencode anything that is presented in another encoding.
The standard way to tell MySQL the used encoding is to send a "SET NAMES utf8;" command directly after opening the connection.

But you were telling that question marks were shown somewhere. If this is in a web page, make sure you send an encoding header. In PHP, this would be:
Code:
header('Content-Type: text/html;charset=utf-8');

If it is the command-line client, it could be the OS default encoding that renders the characters.

If it is another database frontend program, you may have to tell it what encoding to use. For instance, SQLYog (see is good encoding aware. Knoda, for instance, is not.

... and good luck with the onions!

+++ Despite being wrong in every important aspect, that is a very good analogy +++
Hex (in Darwin's Watch)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top