Swift-Questions about PHP writing iOS push Chinese garbled

Source: Internet
Author: User


First of all, my code is UTF8, I have tried various transcoding functions iconv_get_encoding iconv mb_convert_encoding
Also the same is garbled ... Ask you greatly, this is very easy for you man-in-God, how to deal with??? Nutation

Incidentally, it doesn't matter if you don't want to answer, I'll find it myself but ask a little bit faster ^_^

At the beginning of the iOS app, you'll perform
Func application (application:uiapplication, didreceiveremotenotification userInfo: [Nsobject:anyobject])

What if I quit (the app is executed in the background) and then open the app? I remember the last time I wrote it, but for a moment I forgot, please advise ... Thank....

Reply content:


First of all, my code is UTF8, I have tried various transcoding functions iconv_get_encoding iconv mb_convert_encoding
Also the same is garbled ... Ask you greatly, this is very easy for you man-in-God, how to deal with??? Nutation

Incidentally, it doesn't matter if you don't want to answer, I'll find it myself but ask a little bit faster ^_^

At the beginning of the iOS app, you'll perform
Func application (application:uiapplication, didreceiveremotenotification userInfo: [Nsobject:anyobject])

What if I quit (the app is executed in the background) and then open the app? I remember the last time I wrote it, but for a moment I forgot, please advise ... Thank....

As long as you add a urlencode before the text string, add UrlDecode after the JSON.

Cases

$arr = UrlEncode (Array (' a ' = ' "Little Gray Wolf ')");
Echo UrlDecode (Json_encode ($arr));

phpThe json_encode second parameter JSON_UNESCAPED_UNICODE to avoid the unicode character being diverted.

First it's not garbled, it's Unicode encoding.
PHP Json_encode will default to convert Chinese to Unicode encoding. If not, add a second parameter Json_unescaped_unicode


  
   "张飞"),JSON_UNESCAPED_UNICODE);
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.