I want Send my information to server But I Can't Send Persian(Farsi) Character
Please Help Me..
Give Me A Sample Code For it
try to use UTF-8 encoding, and this is a sample how to use encoding with POST request:
try { URL url = new URL("your url"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); OutputStreamWriter writer = new OutputStreamWriter( conn.getOutputStream(), "UTF-8"); String request = "test data"; writer.write(request); writer.flush(); System.out.println("Code:" + conn.getResponseCode()); System.out.println("mess:" + conn.getResponseMessage()); String response = ""; BufferedReader reader = new BufferedReader(new InputStreamReader( conn.getInputStream(), "UTF-8")); String line; while ((line = reader.readLine()) != null) { response += line; } System.out.println(new String(response.getBytes(), "UTF8")); writer.close(); reader.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
try to use UTF-8 encoding, and this is a sample how to use encoding with POST request: