I'm developing a chat app for iOS
and I'm trying to store the chat text in a MySQL
database. Normal text works proper, even special chars like german 'umlaute'. I'm sending the text as Json to the server.
What not works is if I use emoticons from the iOS
emoticons keyboard, like this:
{"userid":"1","message":"Test 123 ⚽️❤️"}
I first had the MySQL
database tables as UTF-8
. The result was that the chars: "Test 123 ⚽️❤️"
got stored and the other emoticons got truncated. I have to add I saw the full string like above in the PHP
log, so it seems not to be an issue that PHP
does not receive it correctly. This is how it looks in the php log:
INFO - 2014-12-16 22:25:04 --> New Feed Post. Json: {"userid":"1","message":"Djjdhd"}
The issue is that MySQL
does not store it correctly. I changed the whole database to UTF-16
and even UTF-32
as I thought those chars are not in the UTF-8
range but in the UTF-16
range.
Result was that the emoticons get not truncated yet, but appear as question marks in the database, like this:
"Test 123 ⚽️❤️????????????"
Any idea why these emoticons do not get stored proper?
I saw this post (iPhone emoticons insert into MySQL but become blank value) but it appears that PHP
receives it correctly.
Thanks!