I am making an android application but when I am sending text (My text language is Persian) to the server it shows the characters like this : (سلام به همه). And when I insert some records into Database from phpmyadmin it shows good in the database but when I retrieve it in the android side It shows like this(???????).In other words I say that when you insert something from android side it shows well on other phones but it shows bad in server side database , and when you insert manually via phpmyadmin it shows them well in the MYSQL database but it shows bad in phones.Please help me
<?php
$con=mysqli_connect("localhost","username","pass","dbname");
mysqli_select_db($con,"dbname");
$sqlQ="select * from news";
$result=mysqli_Query($con,$sqlQ);
$row=mysqli_fetch_array($result);
print $row[0];
mysqli_close($con);
?>
This is one of my PHP files , it just sends one row to the android side this is the link how it shows : [1]: http://shayea.tk/gfn.php By the way all my tables and database collations are utf8_general_ci and I tried utf8_persian_ci but it was the same
This is one of my Classes look at this too if I am doing something wrong here :
public class registerserver extends AsyncTask {
private String Link="";
private String Name="";
private String Family="";
private String User="";
private String Pass="";
private String Email="";
public registerserver(String link,String name,String family, String user ,String pass ,String email){
Link = link;
Name = name;
Family = family;
User = user;
Pass=pass;
Email =email;
}
@Override
protected String doInBackground(Object[] params) {
try{
String data = URLEncoder.encode("name" , "UTF8")+"="+URLEncoder.encode(Name ,"UTF8");
data+="&"+URLEncoder.encode("family" , "UTF8")+"="+URLEncoder.encode(Family ,"UTF8");
data+="&"+URLEncoder.encode("username" , "UTF8")+"="+URLEncoder.encode(User ,"UTF8");
data+="&"+URLEncoder.encode("password" , "UTF8")+"="+URLEncoder.encode(Pass ,"UTF8");
data+="&"+URLEncoder.encode("email" , "UTF8")+"="+URLEncoder.encode(Email ,"UTF8");
data+="&"+URLEncoder.encode("status" , "UTF8")+"="+URLEncoder.encode("a" ,"UTF8");
URL mylink = new URL(Link);
URLConnection connect = mylink.openConnection();
connect.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(connect.getOutputStream());
wr.write(data);
wr.flush();
BufferedReader reader = new BufferedReader(new InputStreamReader(connect.getInputStream()));
StringBuilder sb = new StringBuilder();
String line=null;
while ((line = reader.readLine()) !=null){
sb.append(line);
}
register.res=sb.toString();
}catch (Exception e){
}
return "";
}
}