0

I get data from file_get_contents method and convert this data to JSON but when data contain an emoji character, I cannot give this field in JSON file and store it in database. I changed table collation to utf8mb4_general_ci but do not work my code

$update = file_get_contents("php://input");
$update = json_decode($update, JSON_UNESCAPED_UNICODE);

I tried to get JSON in $update and I also tried method below:

$firstname =isset($update["message"]["from"]["first_name"]) ? $update["message"]["from"]["first_name"] : "";
$lastname = isset($update["message"]["from"]["last_name"]) ? $update["message"]["from"]["last_name"] : "";
5
  • The emoji is inside the name? o_O Commented Feb 28, 2020 at 15:30
  • Can you share the JSON with us? Commented Feb 28, 2020 at 15:30
  • I read data in telegram API and some users set emoji in firstname field Commented Feb 28, 2020 at 15:52
  • when json contain emoji do not inssert to database but in this question save string with ??? character Commented Feb 28, 2020 at 15:54
  • Please provide the JSON string, too. See "question mark" in stackoverflow.com/questions/38363566/… Commented Mar 18, 2020 at 3:10

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.