httprequest - Sending a post in android with bad encoding -


i'm sending post content server android. problem data @ server arrives wrong, encoding problems, example "{" arrives "%7b%".

this code android:

 requestparams params = new requestparams();      params.put("alta", "{s}"); string ruta = "http://www.something.com/receive"; client.post(ruta, params,         new asynchttpresponsehandler() {             @override             public void onsuccess(string response) {              }         } 

the server part receiving data, like:

$data = $this->request->data; $data =file_get_contents('php://input'); 

this issue not directly related text encoding per se.

as can seen docs requestparams, text values directly included in url. text included in urls has encoded include characters allowed in urls (ascii), text url encoded.

asynchttpclient automatically encoding in background, receive strings in encoded form on php side.

in order original text sent, can use rawurldecode() or urldecode() function on php side decode encoded string receive.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -