How to handle special characters in json string

前端 未结 1 1368
忘了有多久
忘了有多久 2021-01-26 23:45

I have an app where I store user entered text into a json string. I then store that json string into a file. And then later on display it back by reading the file, extracting th

1条回答
  •  孤街浪徒
    2021-01-26 23:58

    You have to use "UTF-8" for using this kind of special character. For details read http://developer.android.com/reference/java/nio/charset/Charset.html

    You have to encode for your expected character like this way :

    URLEncoder.encode("Your Special Character", "UTF8");
    

    You can check similar question about this issue from here :

    Android: Parsing special characters (ä,ö,ü) in JSON

    0 讨论(0)
提交回复
热议问题