2016-08-01 10:48
浏览 35

android sms sync在服务器端使用json语法错误

I am trying to sync messages of android device to server using Java script object notation, i am able to sync all of the columns e.g. address, date, status, read, type except message body, it gives Java script object notation syntax error. i have gone through many links, they are saying that there are some sort of characters/hidden characters, i tried their solutions but doesn't helped at all, i tried some of these: json_decode returns JSON_ERROR_SYNTAX but online formatter says the JSON is OK json_decode syntax error from valid json

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douxiong4250
    douxiong4250 2016-08-10 07:36

    I am trying to encode android sms message body using JSON and send over the php webservice, but on php end it was not interpreted as JSON because of hidden chracters inside the string of message body. Adding this one line of code to replace hidden characters in string on Android end solves the problem, here's the solution: body.replaceAll("\p{C}", "?");

    点赞 评论