Android的webview.postUrl(URL,Encodingutils.getBytes(POSTDATA," BASE64"))去除" + QUOT;从POSTDATA字符串 [英] Android webview.postUrl(url,Encodingutils.getBytes(postData,"BASE64")) removing "+" from the postdata String

查看:2136
本文介绍了Android的webview.postUrl(URL,Encodingutils.getBytes(POSTDATA," BASE64"))去除" + QUOT;从POSTDATA字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从网页视图到HTTPS服务器发布如图所示以下网址与BASE64的字符集。

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

将数据发送到的WebView加载页面

我POSTDATA字符串是一个Base64恩在其codeD字符串以+

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

当我在上面的URL显示的方式公布我,服务器日志显示POSTDATA字符串缺少+

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

我应该能够从网页视图发布任何数据串,因为我将张贴关于这一点我没有控制的Base64恩codeD字符串。

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.

请帮我解决这个问题。

更新:我甚至尝试这样

String postData = "fileContents=" + fileCon;

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

但仍然是+是从POSTDATA删除当posting.If没有在POSTDATA+,它正确的帖子。

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

推荐答案

在URL和再$ P $的 + 是一个特殊字符psents的空间。在发送之前需要URL-CN code中的参数值。

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");

这篇关于Android的webview.postUrl(URL,Encodingutils.getBytes(POSTDATA," BASE64"))去除" + QUOT;从POSTDATA字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆