在脸书墙上贴希伯来语+英语文字,单词混淆了



我用我的java代码在FB墙上发帖

FacebookType publishMessageResponse = facebookClient.publish(
    connection,
    FacebookType.class,
    Parameter.with(
        "message",
        fbMessageData.getRecipeOwnerName() +
            " posted " +
            fbMessageData.getRecipeName()
    )
);

消息应该是:Yoav posted מתכון,但是,它是这样发布的:מתכון Yoav postedמתכון是配方名称。配方名称可以是英语或希伯来语(UTF-8)。

关于如何维持秩序有什么想法吗?

您是否尝试过使用Unicode BiDi_Control字符之一?把它放在你的食谱名称前面或周围…

http://en.wikipedia.org/wiki/Bi-directional_text

在发送到fb之前,您应该先进行json_encode,然后再进行json_edecode,这就完成了任务:

$album_details = array(
  'message'=> 'Live photos from our app',                      
  'name'=> $title, // This can be any non-english characters that can be in unicode
  'access_token'=>$pageAccessToken
);
$jsonStr = json_encode($album_details);
$decoded_album_settings = json_decode($jsonStr, true);
$create_album = $this->facebook->api('/'.$this->facebookPageId.'/albums', 'post', $decoded_album_settings);

这个想法来自这里:https://stackoverflow.com/a/3806967/1200166

最新更新