Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS App Emoji issues - JSON doesn't encode them properly
    primarykey
    data
    text
    <p>Sorry this may sound like madness. So the main issue is that if my data from the web service is json_encoded then most emojis show up as squares in the app. Not all but most. I am trying to fix this on the web service side.</p> <p>I found that if I do not use json_encode, the instead do something like:</p> <pre><code>$array .= '{"text":"emoji"} echo = '[' . $array . ']'; </code></pre> <p>Basically echoing it as if its json encoded. The emojis show up correctly in the app, but other things doing work properly because its not encoded. So what I figured out using mb_detect_encoding is that the text that has an emoji is UTF-8 and ones that don't have emoji are ASCII. So what I did is check that I can check and see if its not UTF-8 and if its not just json_encode the string. And if it is UTF-8 and do nothing to it. That works for 95% of all the data that is returned. Something like below.</p> <pre><code>$encode = mb_detect_encoding($theMemo); if($encode != 'UTF-8'){ $theMemo = json_encode($theMemo); } $array .= '{"text":"' . $theMemo . '"} echo = '[' . $array . ']'; </code></pre> <p>The issue I am having is there are time such as when the text is something like "Floyd Mayweatherâ€@FloydMayweather #TheMoneyTeam" which has some unicode in it, but its not the emojis so I need to json_encode it for it to show up right.</p> <p>Basicly I need to find a way to either json_encode anything that does not have a emoji in it or find a more proper way of going about this. I know what I am doing may seem odd, but I am just trying to find a solution, even if it seems like a hack.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload