immobiliare / ApnsPHP

ApnsPHP: Apple Push Notification & Feedback Provider
BSD 3-Clause "New" or "Revised" License
1.43k stars 454 forks source link

utf-8 and Internal error #167

Open hibinyru opened 5 years ago

hibinyru commented 5 years ago

Hello

after the translation of website to utf-8, push no longer sent Writes: Internal error (127 by written in instead of 105 bytes)

If I try to send in Latin, it sends 3 push (i received its push-messages) and writes its an error.

If I try to send a Cyrillic symbols at UTF-8, then I get an error and the push does not come.

If in the Push.php file I change the line $nLen = strlen ($aMessage ['BINARY_NOTIFICATION']); to $nLen = mb_strlen($aMessage ['BINARY_NOTIFICATION'], 'latin1'); push in Latin comes successfully and there are no errors

Cyrillic does not reach (but does not show errors)

$ nLen = mb_strlen construction ($ aMessage ['BINARY_NOTIFICATION'], 'utf-8'); Does not help. how to be?

(sorry fo my english)

hibinyru commented 5 years ago

use

if ((int) ini_get('mbstring.func_overload') & 2) {
    $nLen = mb_strlen($aMessage['BINARY_NOTIFICATION'], '8bit');
} else {
    $nLen = strlen($aMessage['BINARY_NOTIFICATION']);
}

if write '8bit' or 'latin1' - push in english symbols send succesfully and no error, BUT if use russian symbols - no error and push don't get

Help please