Questions tagged [utf8mb4]

Unlike its `utf8` encoding, MySQL’s `utf8mb4` encoding offers full Unicode support (including four-byte UTF-8-encoded symbols).

Unlike its utf8 encoding, MySQL’s utf8mb4 encoding offers full Unicode support (including four-byte UTF-8-encoded symbols).

The utf8mb4 character set is useful because nowadays we need support for storing not only language characters but also symbols, newly introduced emojis, and so on.

utf8mb4 has been available since MySQL 5.5.3 (released March 2010).

A nice read on How to support full Unicode in MySQL databases by Mathias Bynens can also shed some light on this.

More information about the utf8mb4 character set may be found on the official MySQL Documentation.

398 questions
6
votes
3 answers

MySql returns wrong results for emoji strings

My database, tables, fields all are using utf8mb4. I can store well emoji symbols into some fields. Now I try to query such as: SELECT * FROM user WHERE name='' Amazing, the result are records with field names different such as '' Looks like mysql…
Tony
  • 1,551
  • 20
  • 21
6
votes
1 answer

After MySQL change to utf8mb4, Error Unknown character set index for field '224' received from server

I've changed our server MySQL database to use utf8mb4 because we need to support emoticon. I have followed the instruction based on How to support full Unicode in MySQL databases article by Mathias Bynens. The only difference is I wasn't changing…
Nick Eng
  • 61
  • 1
  • 1
  • 3
6
votes
2 answers

phpMyAdmin mysql saved Emoji as Question mark

I want to save Emoji into MySql database, and I realize, three bytes Emoji is saved correctly in the database, but 4 byte emoji have been saved as question marks. It seems like I did fully convert utf8 to utf8mb4, but I dont know what exactly is…
user2002692
  • 971
  • 2
  • 17
  • 34
5
votes
1 answer

General error: 1366 Incorrect string value: '\xF0\x9F\x8D\xB8 !...'

The following error appears when a user sends a message containing an emoji (precisely, when the message is stored in MySql database) : PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x8D\xB8 !...' for column…
Fifi
  • 3,360
  • 2
  • 27
  • 53
5
votes
4 answers

Insert emoji does not work with spring-boot and MariaDB

I would like to insert emoji like in mariaDB database but I always get a sql error. Here is the stacktrace: 12-01-2018 16:01:44.466 [Executor - Migration - 1] WARN o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions:129 - SQL Error: 1366, SQLState:…
psv
  • 3,147
  • 5
  • 32
  • 67
5
votes
3 answers

Caused by: java.sql.SQLException: Unsupported character encoding 'utf8mb4'

I am writing an app that is going to heavily use utf-8 encoding. For the server I'm using java servlets, and for the UI I'm using Java Servlets with jsp and javascript. So, after ignoring the gibberish for some time, I decided to solve the utf-8…
Ma'or
  • 95
  • 1
  • 2
  • 11
5
votes
0 answers

Storing emojis in MySQL database

I'm using Spring boot and I can't store emojis in database. I don't have access to my.cnf file. What I've done so far is: ALTER DATABASE name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; For each table: ALTER TABLE table CONVERT TO…
foxbuur
  • 169
  • 1
  • 9
5
votes
1 answer

Should I use utf8mb4 instead utf8?

What practical advantages and disadvantages does utf8mb4 provide, except ability to use Emoji? As I understand it takes more space to store.
ProgZi
  • 1,028
  • 3
  • 14
  • 25
5
votes
1 answer

Saving emoji characters in mysql database

I am trying to save some data on mysql database, input contains emoji characters like this : '\U0001f60a\U0001f48d' and I'm getting this error: 1366, "Incorrect string value: '\\xF0\\x9F\\x98\\x8A\\xF0\\x9F...' for column 'caption' at row 1" I…
Hosein Remezan
  • 438
  • 9
  • 19
5
votes
1 answer

mysql utf8mb4_unicode_ci cause unique key collision

I have a table like this CREATE TABLE `mb1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `u_name` (`name`) ) ENGINE=InnoDB DEFAULT…
hbprotoss
  • 1,385
  • 10
  • 27
5
votes
1 answer

Mysql UNIQUE KEY constraint - a and å are treated as the same characters

I have a unique key on a column. When I insert a and then å it throws an error: PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'å' for key 'constraint-1'' in…
Dannyboy
  • 1,963
  • 3
  • 20
  • 37
5
votes
1 answer

How to remove any utf8mb4 characters in string

Using C# how can utf8mb4 characters (emoji, etc.) be removed from a string, so that the result is full utf8 compliant. Most of the solutions involve changing the database configuration, but unfortunately I don't have that possibility.
Rafael
  • 1,099
  • 5
  • 23
  • 47
5
votes
3 answers

Emoji is not stored properly in MySQL 5.6 with collation utf8mb4

I am trying to store emoji to the database in my server. I am using AWS EC2 instance as server, my server details are listed below: OS: ubuntu0.14.04.1 MySQL version: 5.6.19-0ubuntu0.14.04.1 - (Ubuntu) Database client version: libmysql - mysqlnd…
Code Help
  • 72
  • 1
  • 6
5
votes
1 answer

MySQL - Invalid utf8mb4 character string on update

My question is almost exactly the same as the one found here MySQL - 1300 - Invalid utf8 character string on update No solution was presented and the help from the person (creating a temporary table) didn't seem to help. Here is the select statement…
Aram Papazian
  • 2,453
  • 6
  • 38
  • 45
5
votes
3 answers

IOS cannot decode emoji unicode in json format correctly, and Emoji icons are displayed as squares

I am working on an iPhone app which allows people to send messages with Emoji icons. I saved the icon in Mysql with charset utf8mb4 and collation utf8mb4_unicode_ci, and all the emoji icons is saved correctly in my database. However, when I return…
user2002692
  • 971
  • 2
  • 17
  • 34