URL
my にいくつかのパラメータを追加して を構築しようとしていますBASEURL
: 問題は、パラメータがBASEURL
無秩序に my に追加され、文字é
が次のような奇妙なものに置き換えられることです%C3%A9
String BASEURI="myBaseUri";
void getParameters()
{
HashMap<String, String> map=new HashMap<String, String>();
final String login = ((EditText)alertDialogRegister.findViewById(R.id.regLogin)).getText().toString();
final String password= ((EditText)alertDialogRegister.findViewById(R.id.regPassword)).getText().toString();
final String passwordConfirm= ((EditText)alertDialogRegister.findViewById(R.id.regPasswordConfirm)).getText().toString();
final String firstName= ((EditText)alertDialogRegister.findViewById(R.id.regPrenom)).getText().toString();
final String lastName= ((EditText)alertDialogRegister.findViewById(R.id.regNom)).getText().toString();
final String sexe=((RadioButton)alertDialogRegister.findViewById(((RadioGroup)alertDialogRegister.findViewById(R.id.regSexe)).getCheckedRadioButtonId())).getText().toString();
final String email= ((EditText)alertDialogRegister.findViewById(R.id.regEmail)).getText().toString();
final String telephone= ((EditText)alertDialogRegister.findViewById(R.id.regPhone)).getText().toString();
final String adresse= ((EditText)alertDialogRegister.findViewById(R.id.regAddress)).getText().toString();
final String civilite=((RadioButton)alertDialogRegister.findViewById(((RadioGroup)alertDialogRegister.findViewById(R.id.regCivilite)).getCheckedRadioButtonId())).getText().toString();
map.put("rquest","addUser");
map.put("login", login);
map.put("password", password);
map.put("firstname", firstName);
map.put("lastname", lastName);
map.put("sex", sexe);
map.put("situation", civilite);
map.put("email", email);
map.put("address", adresse);
registeruser(map);
}
public void registeruser(HashMap<String,String> map)
{
Uri.Builder builder = Uri.parse(BASEURI).buildUpon();
builder.appendPath("api.php");
for(Map.Entry<String, String> entry:map.entrySet())
{
builder.appendQueryParameter(entry.getKey(),entry.getValue());
}
Uri builtUri = builder.build();
Log.i("Hossam", builtUri.toString());
HttpClient httpclient = new DefaultHttpClient();
HttpGet request = new HttpGet(builder.toString());
ResponseHandler<String> handler = new BasicResponseHandler();
String result = null;
try {
result = httpclient.execute(request, handler);
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
httpclient.getConnectionManager().shutdown();
String tag = null;
//Log.i("http response", result);
}