开发者

Danish characters with Easy APNs

开发者 https://www.devze.com 2023-02-18 20:11 出处:网络
I am trying to send Danish characters (Æ, Ø, Å) in an alarm no开发者_开发百科tification using Easy APNs but when doing so, no message is send. If I send it with sound, only the sound is send. Also

I am trying to send Danish characters (Æ, Ø, Å) in an alarm no开发者_开发百科tification using Easy APNs but when doing so, no message is send. If I send it with sound, only the sound is send. Also the message will be set to "null" in the database if it includes any of the Danish characters.

Does anyone know a fix for this?


This was caused by json_encode(). Using utf8_encode() on my alert views before json_encode() solved the issue.

UPDATE (How to fix the issue)

1. In class_APNS.php around line 411, you have

$msg = chr(0).pack("n",32).pack('H*',$token).pack("n",strlen($message)).$message;

Above that, put:

$message = utf8_encode($message);

2. In class_APNS.php (same file) put this:

$usermessage['aps']['alert'] = utf8_encode($usermessage['aps']['alert']);

Put it just above the following:

$fk_device = $this->db->prepare($list[$i]);

$message = $this->_jsonEncode($usermessage);

$message = $this->db->prepare($message);
$delivery = (!empty($when)) ? "'{$when}'":'NOW()';
0

精彩评论

暂无评论...
验证码 换一张
取 消