• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps send get request escapes symbols

acoolcoder

Lurker
Apr 20, 2017
2
0
Hi guys, i try to send blood type of user. it is something in my country; 0 RH + so i can send 0 RH its fine (i can save it db) however +(positive) couldn't send. it is releted with get method beacuse we can't send special characters i guess.

So is there any other way that i can send + positive or - negative symbols with get method.

Code:
sending_url = "?blood="+blood_type;
SendData send = new SendData();
send.execute(sending_url);
//send data
URL url = new URL("http://....com/page.php"+url);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
bufferedReader = new BufferedReader(new InputStreamReader(con.getInputStream()));
 
Last edited:
Hi guys, i try to send blood type of user. it is something in my country; 0 RH + so i can send 0 RH its fine (i can save it db) however +(positive) couldn't send. it is releted with get method beacuse we can't send special characters i guess.

So is there any other way that i can send + positive or - negative symbols with get method.

Code:
sending_url = "?blood="+blood_type;
SendData send = new SendData();
send.execute(sending_url);
//send data
URL url = new URL("http://....com/page.php"+url);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
bufferedReader = new BufferedReader(new InputStreamReader(con.getInputStream()));

You have to encode the query string.
Something like below should work:
Code:
sending_url = "?blood="+ URLEncoder.encode(blood_type, "UTF-8");
SendData send = new SendData();
send.execute(sending_url);
//send data
URL url = new URL("http://....com/page.php"+url);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
bufferedReader = new BufferedReader(new InputStreamReader(con.getInputStream()));
 
  • Like
Reactions: sweetndreemy73
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones