Code Monkey home page Code Monkey logo

Comments (4)

iamcal avatar iamcal commented on June 25, 2024

Take a look at issue #7 - APNS does some weird handling for escaping Unicode, so you'll probably need to manually find the surrogate pair and then double encode your emoji. e.g.

$message = "\\uD83D\\uDCC5" . "This is an emoji";

Let me know if that works for you and i'll update the README

from php-emoji.

vikmalhotra avatar vikmalhotra commented on June 25, 2024

The suggested solution did not work. Instead of emoji, I am now getting a \? in the notification. Here's what I get now in push notification...

?This is an emoji.

Here is a gist of the code I used.

from php-emoji.

iamcal avatar iamcal commented on June 25, 2024

It seems like Apns-PHP is just broken. Find this line in ApnsPHP/Message.php:

if (!defined('JSON_UNESCAPED_UNICODE') && function_exists('mb_convert_encoding')) {

It should be around line 376. Add && 0 into the conditional, to stop it from ever firing. It should then work. My test code is here: https://gist.github.com/iamcal/6169622

from php-emoji.

vikmalhotra avatar vikmalhotra commented on June 25, 2024

@iamcal - Thank you very much for your prompt support. The solution you suggested worked out well.

Just for information, the code in APNS-PHP that will not be fired is the one related to truncating a payload if it exceeds the limit of permissible push notification size (256 bytes).
I had some payloads exceeding the limit, so I decided to truncate them before sending the push notification, instead of making APNS-PHP handle the truncating.

from php-emoji.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.