I am using volley library for json i have done
String header=sirsak.getText().toString().replace(" ","");
Log.d("header::",header); //here sirsak is edit text***strong text***
to take String from edit text..
and tried to concatenate with url
String posturl="http://54.193.70.29:8080/ghosanapatra/message/addMessageA?message=message&cId=1&heading="+header+"&eId=1&pId=268&wId=1&name=name&memberFbId=123&phone=9860327645";
StringRequest postrequest=new StringRequest(Request.Method.GET,posturl, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
pd=new ProgressDialog(GiveSujab.this);
pd.setMessage("loading.");
pd.setCancelable(false);
pd.show();
try {
JSONObject saveobj = new JSONObject(response);
String savestatus = saveobj.getString("save");
if (savestatus.equals("sucess")) {
Toast.makeText(GiveSujab.this, "", Toast.LENGTH_SHORT).show();
Intent intent=new Intent(GiveSujab.this,MainActivity.class);
startActivity(intent);
}
}catch (Exception e){
Toast.makeText(GiveSujab.this, "error", Toast.LENGTH_SHORT).show();
}
pd.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
requestqueue.add(postrequest);
It works when i type English text in EditText but not working when i type in Nepali language like"नेपाली" It shows like http://54.193.70.29:8080/ghosanapatra/message/addMessageA?message=message&cId=1&heading=नेपालीको&eId=1&pId=268&wId=1&name=name&memberFbId=123&phone=9860327645
How can i solve this?
finally i got the code
String header = sirsak.getText().toString();
String encode = URLEncoder.encode(header,"UTF-8");
its very simple