Php 推送iOs通知西班牙语字符

Php 推送iOs通知西班牙语字符,php,ios,push-notification,apple-push-notifications,Php,Ios,Push Notification,Apple Push Notifications,我对西班牙语字符“ñ”和推送iOs通知有问题。 我使用PHP脚本发送通知。在发送之前,我将消息编码为utf8,这是很好的。问题是,当我在有效负载中发送带有“ñ”的通知时,我没有收到它,但带有其他特殊字符“á”、“é”…,我收到它时没有任何问题 $text = "España"; $json = '{"data":{"text":"' . $text . '"}}'; $passphrase = 'passphase'; $message = utf8_encode($json); $ctx

我对西班牙语字符“ñ”和推送iOs通知有问题。 我使用PHP脚本发送通知。在发送之前,我将消息编码为utf8,这是很好的。问题是,当我在有效负载中发送带有“ñ”的通知时,我没有收到它,但带有其他特殊字符“á”、“é”…,我收到它时没有任何问题

$text = "España";
$json = '{"data":{"text":"' . $text . '"}}';
$passphrase = 'passphase';  
$message = utf8_encode($json);
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem');
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
// Open a connection to the APNS server
$fp = stream_socket_client(
      'ssl://gateway.sandbox.push.apple.com:2195', $err,
      $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
if (!$fp)
    exit("Failed to connect: $err $errstr" . PHP_EOL);
echo 'Connected to APNS' . PHP_EOL;
// Create the payload body
$body['aps'] = array(
    'alert' => $message,
    'sound' => 'default'
    );
// Encode the payload as JSON
$payload = json_encode($body);
// Build the binary notification
$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken[$i]) . pack('n', strlen($payload)) . $payload;
// Send it to the server
$result = fwrite($fp, $msg, strlen($msg));
if (!$result)
   echo 'Message not delivered' . PHP_EOL;
else
   echo 'Message successfully delivered' . PHP_EOL;
编辑:

特殊字符“ñ”发送正确,我的问题是发送的数据多于$text($text变量是为了更好地解释代码而编写的)。在iOs推送通知中,有一个负载大小限制,我的消息超过了它,因此设备没有收到它。我的应用程序中只有一个文本出现了这种情况,因为它是最大的,而且是唯一一个带有“ñ”的文本。 因此,如果没有收到消息,请检查字符数。

尝试使用Entite

$text="España"
...
苏伊萨酒店