|
Posted by Dikkie Dik on 10/14/07 09:54
> My http.conf states that my default character set is UTF-8.
good, although it is probably not used for php files
>
> My php.ini has a default charset of utf-8 and a default mime-type of
> text/html
Even better. This causes php sites to rendered in utf-8.
> I have executed the Set Names command before sending the query to
> MySQL.
>
> The output just gives me question marks.
The characters may be stored in another encoding by your previous attempts.
> I've obviously missed something. Incidentally, for testing purposes I
> am copying and pasting chinese characters from an Excel File (and also
> from Chinese sites online). When I paste them into MySQL (using
> HeidiSQL) they appear as squares and then, when I move away from the
> field, become question marks....
>
> Any thoughts?
Yes: monitor what's going on. I am going to assume you have a
development database on your local PC.
Reconfigure MySQL to switch on the "query logging". This means that all
queries are written to a log file. Effectively, it allows you to see
what MySQL has done.
For monitoring the log file, I can recommend the freeware version of
BareTail (see http://baremetalsoft.com/ ). It shows the log in real-time
and you can set the encoding to utf-8.
When you have this monitor up and running, do your tests again.
The log file will tell you a lot:
- the connection number is present, so you can see if the SET NAMES
command was executed in the same connection as the INSERT and SELECT
commands. If it was not, the SET NAMES command was not effective.
- You see the actual INSERT end SELECT commands. You will not see
anything special about the select commands because the log file does not
contain the results, but you do see what was inserted using the INSERT
commands.
I can really recommend you to take a look at the output of the mysqldump
utility. You can use it to dump the output of a query if you are afraid
of dumping too much data. If the characters are wrong in the output of
mysqldump, they are wrong in the database as well.
Furthermore, I don't know HeidiSql. You might have to set the encoding
inside that program as well.
Good luck!
Navigation:
[Reply to this message]
|