2

I am receiving messages from Facebook Messenger to my PHP server.

I json_decode the request like this:

$facebookRequest = json_decode( file_get_contents('php://input'), true );

After that, the emojis in the text all come out as these strange characters, and not as Hex or Unicode formats.

The characters don't even post correctly here so here is a screenshot of them:
strange characters that's from a simple smiley face.

Now I can reverse the text through json_encode then I get: \u00f0\u009f\u0098\u0080.

Is there a better way to handle emojis passing through json_decode?

Jay A. Little
  • 3,239
  • 2
  • 11
  • 32

1 Answers1

0

Try rawurlencode or decode methods before passing to json_ decode.

http://php.net/manual/en/function.rawurlencode.php

Mayur Shedage
  • 1,027
  • 2
  • 11
  • 19