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
8
votes
2 answers

Does using ASCII/Latin Charset speed up the database?

It would seem that using the ASCII charset for most fields and then specify utf8 only for the fields that need it would reduce the amount of I/O the database must perform by 100%. Anyone know if this is true? Update: The above was not really my…
mbalsam
  • 611
  • 1
  • 6
  • 16
8
votes
5 answers

Django MySQL 'utf8' is currently an alias for the character set UTF8MB3, which will be replaced by UTF8MB4

I am using Django 2.0.4, MySQL 8.0.11, mysqlclient-1.3.12 and Python 3.6.5 on Mac Sierra. I am receiving the following warning: /lib/python3.6/site-packages/django/db/backends/mysql/base.py:71: Warning: (3719, "'utf8' is currently an alias for the…
Lehrian
  • 347
  • 1
  • 2
  • 9
8
votes
2 answers

The ultimate emoji encoding scheme

This is my environment: Client -> iOS App, Server ->PHP and MySQL. The data from client to server is done via HTTP POST. The data from server to client is done with json. I would like to add support for emojis or any utf8mb4 character in general.…
8
votes
3 answers

Migrating MySQL UTF8 to UTF8MB4 problems and questions

Im trying to convert my UTF8 MySQL 5.5.30 database to UTF8MB4. I have looked at this article https://mathiasbynens.be/notes/mysql-utf8mb4 but have some questions. I have done these ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE =…
Banshee
  • 15,376
  • 38
  • 128
  • 219
8
votes
3 answers

Specified key was too long - max key length is 767 bytes

When I executed the following command: create table assessment ( id integer not null auto_increment unique, assignment_weight_type tinyint not null, description varchar(255), end_date datetime not null, from_grade tinyint not…
user899876
8
votes
1 answer

Emoji on MySQL and PHP: why some symbol yes other not?

After reading all the topics about emoji on SO I'm bounded to ask for some help. Question seems to be almost the same: I got an iPhone App sending via PHP emoji to MySQL DB, I can see some symbol on records, as example "umbrella" and "cloud" but…
Fabrizio
  • 514
  • 7
  • 18
7
votes
3 answers

mysqli not setting charset to utf8mb4

Problem found The problem seems to be that $mysqli->set_charset() is not accepting `utf8mb4' as a valid encoding (just as I "speculated" in the first update). MySQL version is 5.5.41 and PHP version is 5.4.41 (no problem with that). Sorry for the…
Chazy Chaz
  • 1,781
  • 3
  • 29
  • 48
7
votes
1 answer

Stored Procedure collation_connection is utf8mb4_general_ci instead of utf8mb4_unicode_ci using Hiedisql mysql

I am using Hiedisql V9.2. I set default server character-set is utfmb4 and collation is utf8mb4_unicode_ci but after create stored procedure still show collation_connection =utf8mb4_general_ci. Below is server my.ini…
Rikin Patel
  • 8,848
  • 7
  • 70
  • 78
7
votes
2 answers

How do I store unicode emoji to MYSQL in CodeIgniter

I'm using codeigniter and trying to save to a MYSQL database table The error i'm getting is Incorrect string value: '\xF0\x9F\x9A\x9A' for column 'post'
PK.
  • 2,471
  • 3
  • 24
  • 30
7
votes
2 answers

Manipulating utf8mb4 data from MySQL with PHP

This is probably something simple. I swear I've been looking online for the answer and haven't found it. Since my particular case is a little atypical I finally decided to ask here. I have a few tables in MySQL that I'm using for a Chinese language…
Yhilan
  • 269
  • 1
  • 3
  • 15
6
votes
1 answer

Is it safe to update tables from utf8 to utf8mb4 in MySQL?

I am aware that similar questions have been asked before, but we need a more definitive answer. Is it safe to update MySQL tables encoded in utf8 to utf8mb4 in all cases. More specifically, even for varchar fields with strings generated using for…
Nico Huysamen
  • 10,217
  • 9
  • 62
  • 88
6
votes
3 answers

emojis show up as question marks after inserting into database php

I have used utf8mb4 as the encoding and character_set_connection and character_set_database have been set as utf8mb4. The charset in my webpages is set to utf8. I have used PDO and when I open the connection to the database I use utf8mb4 as the…
Vipul Sharma
  • 525
  • 9
  • 23
6
votes
2 answers

How to convert variable (text/string) to utf8mb4 in php

Hi I'm looking for a encode function for utf8mb4, $var = = "نور"; echo utf8mb4_encode($string); output = نور // its $var output in UTFMB4 The output should be "نور" this, its a conversion of $var in utfmb4
Mukhyyar
  • 115
  • 1
  • 1
  • 11
6
votes
1 answer

How can I remove characters that are not supported by MySQL's utf8 character set?

How can I remove characters from a string that are not supported by MySQL's utf8 character set? In other words, characters with four bytes, such as "", that are only supported by MySQL's utf8mb4 character set. For example, C = -2.4‰ ± 0.3‰; H =…
Matthias Munz
  • 3,583
  • 4
  • 30
  • 47
6
votes
1 answer

PHP PDOException: SQLSTATE[HY000] [2019] Can't initialize character set utf8mb4

I have drupal 8 installed on Centos 6. Here is my php and mysql -version output Server version: 5.7.9 MySQL Community Server (GPL) PHP 5.6.14 (cli) (built: Oct 16 2015 08:41:09) But i still getting a connection error PDOException: SQLSTATE[HY000]…
vaninv
  • 153
  • 2
  • 5
1 2
3
26 27