Background
We have decided to transfer the original system from one server to another.
Export
mysqldump-u root-p DBNAME --default-character-set=binary>~/DBNAME.sql
import
I imported it using phpMyAdmin because I couldn't type the command directly.
At this time, I tried utf8, sjis, binary, etc. for the "File Character Set:", but the results have not changed.
Test connection with Perl
When Perl connects to the database, there is no garbled characters in Japanese, and the migrated data is read beautifully.This is UTF8.
However, the actual system is PHP, so it was only a confirmation of operation.
Connect via PHP
When connected via PHP, the characters were already garbled at phpMyAdmin, and the desired system only has Japanese characters, so there is no sign of healing.
Tried
I tried it by using internet search.
information
MySQL:5.5.28
phpMyAdmin —3.3.10.5
PHP:PHP 5.4.40
That's all.
Thank you for your cooperation.
I probably solved it myself, so I will answer it.
After adding the following code to the beginning, you can now display it without garbled characters.
mysql_set_charset('utf8',$con);
This post was posted as a community wiki based on what @Monon added to the body of the question.
© 2024 OneMinuteCode. All rights reserved.