UTF-8 encoding in Volley Requests

后端 未结 8 1501
天命终不由人
天命终不由人 2020-12-06 02:17

In my Android app I am loading json data with a Volley JsonArrayRequest. The data were created by myself and I saved them with Sublime with UTF-8 encoding. When

8条回答
  •  不思量自难忘°
    2020-12-06 02:40

    I had the same problem earlier two days ago and i have tried every thing my friends just said and it`s the same problem and i tried so meany things .. my file is written in php and using volley to get the data as json i followed these steps to solve the problem ..

    1. before executing the query in your database write this query

      mysqli_query($this->connection,"set_NAMES_utf8");

    2. use this header in your file if it`s php

      header('Content-Type: application/json ; charset=utf-8 ');

    3. while you are echoing the json according to php there is a solve for this problem use this special charachter in json_encode($json,JSON_UNESCAPED_UNICODE)

      i hope it helped

提交回复
热议问题