Android using json in client-side and server-side garbled words in Chinese, the server-side debugging, has shown correctly in Chinese, but to the client or Chinese garbled, is in Chinese???????
no.The HTML code is as follows, only put up part of the code
Protected void onCreate (Bundle savedInstanceState) {
List=new ArrayList
Gv=(the GridView) the findViewById (R.i d.s uyuan_gridview);
MyAdapter=new myAdapter ();
Gv. SetAdapter (myAdapter);
Intent Intent=getIntent ();
Bundle Bundle=intent. GetExtras ();
No=bundle. Get string (" STR ");
}
String doGetShuYuanMsg (String url) {
List
NameValuePair p=new BasicNameValuePair (" no, no);
List. Add (p);
String MSG=HttpUtil. DoPost (url, a list);
return msg;
}
The class MyTask extends AsyncTask
@ Override
Protected void onPostExecute (String result) {
//TODO Auto - generated method stub
Super. OnPostExecute (result);
Gson Gson=new Gson ();
Type Type=new TypeToken
- () {}. GetType ();
List=gson. FromJson (result, type);
MyAdapter. NotifyDataSetChanged ();
}
}
The class MyAdapter extends BaseAdapter {
@ Override
Public int getCount () {
//TODO Auto - generated method stub
Return the list. The size ();
}
@ Override
Public Object the getItem (int position) {
//TODO Auto - generated method stub
return null;
}
@ Override
Public long getItemId (int position) {
//TODO Auto - generated method stub
return 0;
}
SuYuan s=list. Get (position);
Tv1. SetText (s.g etNo ());
Tv2. SetText (s.g etType ());
Tv3. SetText (s.g etPlace ());
Tv4. SetText (s.g etEnterprise ());
Network tv5 took. SetText (s.g etMaintainer ());
Tv6. SetText (s.g etChecker ());
Tv7. SetText (s.g etGrade ());
Tv8. SetText (s.g etBatch ());
}
CodePudding user response:
HTTP headers set the encoding format, are generally not utf-8, stil are usually results from coding is inconsistentCodePudding user response: