Issue
I have an android application and i have connected it to a mysql database
The database contain arabic words, When i select these words from the database arabic words will be decayed as shown bellow in the image

the result must be like this
sho = فەفف
hawkar= Array
nechir= Array
test= Array
And as show bellow the Collation of my database is utf8_general_ci like shown bellow arabic words dosn't have any problem within the table
And this is the code of background works
protected String doInBackground(String... params) {
String login_url="http://kurddic.site88.net/login2.php";
String method=params[0];
if(method.equals("register")){
}
else if(method.equals("login")){
try {
URL url=new URL(login_url);
HttpURLConnection httpURLConnection=(HttpURLConnection)url.openConnection();
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setDoInput(true);
httpURLConnection.setDoOutput(true);
InputStream inputStream=httpURLConnection.getInputStream();
BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(inputStream, "iso-8859-1"));
String response="";
String line="";
while ((line=bufferedReader.readLine())!=null) {
response+=line;
}
bufferedReader.close();
inputStream.close();
httpURLConnection.disconnect();
return response;
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
And this is the php selection code
<?php
require "config.php";
$sql_query = "select en,ku from words where active='1'";
$result=mysql_query($sql_query);
if($qq=mysql_num_rows($result)>0){
while($row=mysql_fetch_assoc($result)){
$name=$row["en"];
$name2=$row["ku"];
echo $name."= ".$name2;
echo"<br/>";
}
}
else{
echo "no info is available";
}
?>
Note that iam using Genymotion emulator
Is the problem is with my emulator or what?
Thanks for any help....
Solution
Edit your code:
BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
Answered By - bryan c
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.