URLEncoder ile türkçe karakter sorunu
27.06.2018 - 02:17
URLEncoder kullanarak türkçe karakter sorununu aşmaya çalışıyorum fakat başarılı olamadım.
Java Kodlaması;
URL url = new URL(register_url);
HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true);
OutputStream outputStream = httpURLConnection.getOutputStream();
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8"));
String post_data = URLEncoder.encode("user_name", "UTF-8")+"="+URLEncoder.encode(user_name, "UTF-8")+"&"+URLEncoder.encode("password", "UTF-8")+"="+URLEncoder.encode(password, "UTF-8");
//String post_data = "user_name="+user_name+"&password="+password;
Log.d("Kayıt Ol Argümanları", post_data);
bufferedWriter.write(post_data);
bufferedWriter.flush();
bufferedWriter.close();
outputStream.close();
InputStream inputStream = httpURLConnection.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "ISO-8859-1"));
Android Girdisi;
üğşçöı
Android Log Çıktısı;
user_name=%C3%BC%C4%9F%C5%9F%C3%A7%C3%B6%C4%B1
MySQL Çıktısı (latin5_turkish_ci ve utf8_general_ci);
üğşçöı
603
Görüntülenme
0 Beğeni