3

I am require to fetch fields of record from table available MySQL and show the same text in android application via sending request to php server. I am able to fetch and display gujarati text in browser properly using below code,

header('Content-type: text/plain; charset=utf-8');
include('connection.inc.php');
$SelectQuery="select * from criminal_info where id=3";
$criminal=mysql_query($SelectQuery) or die(mysql_error());
$row=mysql_fetch_array($criminal);
echo utf8_encode($row['cname']);

but when I display same text in android in TextView, after getting response from php wamp server I get below given strange output.

છગન  

I use below given android code to display text in

t1=(TextView)this.findViewById(R.id.textView1);
t2=(TextView)this.findViewById(R.id.textView2);
Typeface font= Typeface.createFromAsset(getAssets(), "aakar-medium.ttf");
t1.setText("આજે રવિવાર છે. કેમ છો બધા મજા માં?");
t1.setTypeface(font); 
t2.setTypeface(font);
String result;
try
{
result = new String 
(NetworkHandler.SendRequestonURLViaGET("trial.php").getBytes(),"UTF-8");
result = NetworkHandler.SendRequestonURLViaGET("trial.php");
t2.setText(result);
//Log.w("result"," " + result.length());
}
catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

0 Answers0