UTF8 payloads containing diacritics are broken #7

Closed
dcelasun opened this Issue Oct 22, 2013 · 8 comments

Comments

Projects
None yet
4 participants

In Message.php line 303 the existence of JSON_UNESCAPED_UNICODE results in messages not being delivered to the device if the payload contains diacritics.

I've used the message çşiğüı as payload and removing JSON_UNESCAPED_UNICODE bit seems to fix the problem.

This is probably not the ideal fix as I didn't investigate any further after removing that part.

dcelasun referenced this issue in Ph3nol/NotificationPusher Oct 22, 2013

Closed

APNS doesn't send messages with diacritics #15

asapo commented Nov 1, 2013

I think this probrem caused by wrong $length of payload.
It used mb_strlen but it returns UTF-8 char count, so it should use strlen for byte length.

We need JSON_UNESCAPED_UNICODE, because it being able to send more message.

strlen('çşiğüı') = 11
strlen('\u00e7Ÿi\u011f\u00fc\u0131') = 26

dcelasun commented Nov 1, 2013

I think this probrem caused by wrong $length of payload.

Yep, looks like it.

We need JSON_UNESCAPED_UNICODE, because it being able to send more message.

How so? Do you have any examples?

asapo commented Nov 1, 2013

How so? Do you have any examples?

Because payload can contain 256bytes. Not characters.

https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW4

Payload
variable length, less than or equal to 256 bytes

dcelasun commented Nov 1, 2013

I see. So, changing mb_strlen to strlen should be enough?

asapo commented Nov 1, 2013

Probably. But I want to hear the opinions of other people.

kwn commented Nov 7, 2013

+1 fix with strlen

@GeorgioA GeorgioA pushed a commit to GeorgioA/ZendService_Apple_Apns that referenced this issue Dec 4, 2013

Bertrand Duthoit FIX zendframework#7 65efb3c
Contributor

mwillbanks commented Dec 6, 2013

Yes; this is indeed so that we can send longer messages when it is supported. I can update the unit test at some point here soon so that we can get this merged in. My apologies as I ahve been inactive for the last month.

@mwillbanks It's been 4 months, so any updates on this?

@baryshev baryshev added a commit to baryshev/ZendService_Apple_Apns that referenced this issue Apr 15, 2014

@baryshev baryshev Fix for wrong UTF-8 payloads length calculation #7 9ee8be2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment