vendredi 27 février 2015

HTML Form/Textarea with Emoji store to MySQL Database

I have a small Website where Users can post a status. If a User post a status with an Emoji (e.g. from iOS) the Emoji Char get stored in the MySQL Database like this: 😁


I'm using an MySQL Version 5.5 with utf8mb4:



+--------------------------+--------------------+
| Variable_name | Value |
+--------------------------+--------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| collation_connection | utf8mb4_general_ci |
| collation_database | utf8mb4_general_ci |
| collation_server | utf8mb4_general_ci |
+--------------------------+--------------------+


But the Text/Emoji get always stored as HTML entity. The PHP files are UTF-8 Encoded and the Form looks like this:



<form id="submit_form" action="myAction.php" method="post">


How do i get the real Emoji Char instead of an HTML entity?


Aucun commentaire:

Enregistrer un commentaire