将带有特殊字符的消息发送到 pubnub 服务器抛出 php sdk


Sending message with special chars to pubnub server throw php sdk

问题:当我从php发送到pubnub时:

$msg = array("author"=>"MisterX","text"=>"Who's here?"); 
$pubnub = new Pubnub(PubNubPublishKey,PubNubSubscribeKey,PubNubSecretKey);
$publish_result = $pubnub->publish('chat1',$msg);

客户端(在 JS SDK 上)收到如下消息:

X先生:谁在这里?

但是当客户端从JS发送相同的消息时,它工作正常:

X先生:谁在这里?

是 PubNub PHP SDK 中的错误吗?也许我需要在放入publish()之前对$msg进行额外的操作,但文档中没有提及。

测试这个

$msg = array("author"=>"MisterX","text"=>"Who's here?"); 
$pubnub = new Pubnub(PubNubPublishKey,PubNubSubscribeKey,PubNubSecretKey);
$publish_result = $pubnub->publish('chat1',$msg);