Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending unified emoji via apn #15

Closed
dgthistle opened this issue Oct 21, 2011 · 6 comments
Closed

Sending unified emoji via apn #15

dgthistle opened this issue Oct 21, 2011 · 6 comments

Comments

@dgthistle
Copy link

Hello again Argon,

Thanks for your work on the reliability issue with bobrik. Another issue came up... I'm not sure if it's an issue on the node-apn side or on the Apple gateway side. Basically, alerts with the emoji unified standard unicode are dropped. Everything on the node side seems to work normally, but the message never arrives on the phone. If I use the old emoji softbank unicode char, for example '\ue415' for a smiley face, it works fine. If I use the new unified unicode standard, which the iPhone emoji keyboard outputs, for example '\uD83D\uDE04', it fails. Given your knowledge of apn on the node side and apple side, perhaps you might have some insight. It's possible that Apple's APN service hasn't caught up with the unified standard or doesn't accept the extended character set. Thank you for any help!

Dave

@dgthistle
Copy link
Author

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.

@argon
Copy link
Collaborator

argon commented Oct 21, 2011

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.

@dgthistle
Copy link
Author

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.

@argon
Copy link
Collaborator

argon commented Oct 24, 2011

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.

@argon argon closed this as completed in 4b03af3 Nov 25, 2011
@ghost
Copy link

ghost commented Jun 15, 2015

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

@argon
Copy link
Collaborator

argon commented Jun 15, 2015

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 notifications@github.com wrote:

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


Reply to this email directly or view it on GitHub.

hharanm pushed a commit to hharanm/node-apn that referenced this issue Apr 16, 2023
Add typings for the "voip" NotificationPushType
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants