3
2

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 3 years have passed since last update.

utf8とutf8mb4の違いについて

Posted at

背景

上記の記事で、Sequel Proでテーブルにインポートができなかったのですが、原因が文字コードの不一致。
元々utf8にしてたのがダメで、utf8mb4じゃないといけない。

じゃこの違いは何なのか?

結論:迷うならutf8mb4

参考文献
https://penpen-dev.com/blog/mysql-utf8-utf8mb4/

簡単に言えば、utf8は1〜3バイトまで対応、utf8mb4は1~4バイトまで対応してます。
つまり4バイトの絵文字はエンコードできず文字化けする、というわけです。

4バイト文字になる一覧

ということで、意外とutf8は対応していないことが多く、汎用性を持たせたいのならutf8mb4で作ったほうが良いですね。

3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?