Pregunta

I have a website that connects with iPhone and Android users. They sometimes use UTF8MB4 characters (Emoji). When inserting those characters in strings in my MySQL database (formatted UTF8) the data was cropped at the first emoji.

Unfortunately, my hoster is running MySQL 5.1.66 and is not planning to update to a newer version yet. So what is the best solution for temporary use without switching the encoding?

¿Fue útil?

Solución

I have searched the web for many hours and I came to this solution which I want to share for other people:

Use BLOB instead of text/varchar in the database fields. Like this, you can continue to use the database tables as you did before and the Emojis are shown properly. As soon as the hoster updates the MySQL version, I will continue with using UTF8MB4 as encoding.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top