0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

データベースの文字化けを直す

0
Posted at

フォームなどを作っているとアルファベットはいいのですが、日本語投稿が?になってしまいます。その改善方法をまとめました。

データベースの文字コードをチェック

show variables like ‘character%’;

を実行してみてください。するとutf8に混じってlatin1が出てこないでしょうか。

データベースの文字コードを修正

set character_set_database=utf8;

こんな感じでlatin1のものをutf8に変更していきます。

テーブルの文字コードを修正

alter table table_name convert to character set utf8;

以上を試した上で、もう一度日本語の投稿をしてみてください。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?