3

I am posting from a Webview to the https server as shown in the below URL with BASE64 as charset.

Send data to page loaded in WebView

My postdata string is a Base64 encoded string with "+" in it.

When i am posting in the way as shown in the above URL, server log shows postdata string with a missing "+"

I should be able to post any data string from the Webview because i will be posting a Base64 Encoded string on which i don't have control.

Please help me solve this issue.

Update:I even tried like this

String postData = "fileContents=" + fileCon;

 mWebView.postUrl(url,postData.getBytes());

But still "+" is removed from postData when it is posting.If there is no "+" in the postData, it posts correctly.

Community
  • 1
  • 1
Sreeram
  • 3,160
  • 6
  • 33
  • 44

1 Answers1

6

The + is a special character in URLs and represents a space. You need to URL-encode the parameter value before sending it.

String postData = "fileContents=" + URLEncoder.encode(fileCon, "UTF-8");
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555