Reputation: 43
I am new to SQL and I don't to know how to save Farsi text (string) with emojis in database.
Do I have to change the collation of database? Right now, its utf8_persian_ci
.
Upvotes: 1
Views: 1096
Reputation: 177
درود they way we do that is by using a utf8mb4_persian_ci
CREATE TABLE `users` (
) DEFAULT CHARSET = utf8mb4_persian_ci
This is how we would go about doing that. Persian Text will be saved using utf8mb4 it also Supports Emoji's and Much Much more !
Upvotes: 2
Reputation: 10643
UTF-8 characters may be any length from 1 to 4 bytes. MySQL made a goof, and their utf8
collation only allows 1 to 3 bytes. 4-byte characters (which include emoji) cannot be saved in MySQL's utf8
collation. Instead, you must use utf8mb4
, which is a newer collation designed to fix the previous error.
So you want utf8mb4_persian_ci
.
Upvotes: 0