Emojis support in Apple push notification

前端 未结 2 674
滥情空心
滥情空心 2021-02-09 02:58

I am working on iPhone app named \"INTERSTIZIO\".In this I have implemented functionality like chat between users.In this user can send text,location and text with emojis symbol

相关标签:
2条回答
  • 2021-02-09 03:40

    you shouldn't need to mess about with html decoding. As you say the code point for smiling face is \u263A. In PHP you can represent that in a UTF8-encoded string as "\xE2\x98\xBA"

    Lightning bolt (actually 'high voltage sign') is \u26A1 or "\xE2\x9A\xA1" in UTF-8.

    Both these characters are present in some non-emoji fonts as regular Unicode symbols. You can see with:

    <?php
    header('Content-type: text/html; charset=utf-8');
    echo "\xE2\x9A\xA1";
    echo "\xE2\x98\xBA";
    

    I don't know where you got &#57661; from, but that would be \ue13d which is in an empty private use Unicode range, and not an Emoji within the Unicode standard Check it here Possibly it's from some other Japanese mobile carrier standard, but for iOS you should use Unicode.

    You can get my above encodings from this table or use this Emoji search tool.

    As for Apple push. This note says you can send emoji as UTF-8 encoded strings, so a json object like {"alert":"\u26A1SHOCKER\u26A1"} sounds like it will work.

    0 讨论(0)
  • 2021-02-09 03:55

    for the googlers. json_encode() adds double \

    $message = "\ue04a";
    $body['aps'] = array(
                       'alert' => $message,
                       'sound' => 'default',
                       'type'  => $type,
                       'param' => $param
                   );
    
    $payload = json_encode($body);
    $payload = str_replace("\", "\\", $payload);
    
    0 讨论(0)
提交回复
热议问题