Code Monkey home page Code Monkey logo

Comments (6)

dgthistle avatar dgthistle commented on June 12, 2024

It looks like the issue is using utf8 encoding on the payload doesn't handle the extended unicode characters (or doesn't play well with APNS). Changing the encoding to usc2 fixes the issue, but I'm not sure if it breaks anything else at this point. Will let you know.

from node-apn.

argon avatar argon commented on June 12, 2024

Oh that's absolutely the case, I'm pretty sure that emoji falls under UTF-16. Let me know how the encoding change goes, I'll investigate unicode support in javascript/node and see what I can find out.

Unicode is crazy.

from node-apn.

dgthistle avatar dgthistle commented on June 12, 2024

The change is very simple and shouldn't break anything since UCS2 is the predecessor to UTF-16. The disadvantage is it halves the number of characters you can fit in the 256 byte payload. So, probably makes sense to give people the option. The change is in sendNotification:

var messageLength = Buffer.byteLength(message, encodingMethod);
...
pos += data.write(message, pos, encodingMethod);

where encodingMethod is 'ucs2' or 'utf8' - default is utf8 for these functions.

from node-apn.

argon avatar argon commented on June 12, 2024

I will add an option for this and update the readme soon. I think I will add this on a per message basis, I am going to refrain from making it a global setting because of the detrimental nature of halving the message length. Thanks for figuring this out.

from node-apn.

 avatar commented on June 12, 2024

Could you please share java code for sending Advance Emoji or images?

from node-apn.

argon avatar argon commented on June 12, 2024

This library is for JavaScript, not Java. Please checkout https://github.com/notnoop/java-apns for a Java version.

―A

On 15 Jun 2015, at 15:19, pashtika [email protected] wrote:

Could you please share java code for sending Advance Emoji or images?


Reply to this email directly or view it on GitHub.

from node-apn.

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.