Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

url参数的问题 #17

Closed
wutongke opened this issue Nov 2, 2016 · 4 comments
Closed

url参数的问题 #17

wutongke opened this issue Nov 2, 2016 · 4 comments

Comments

@wutongke
Copy link

wutongke commented Nov 2, 2016

当url中存在“/”符号时,会有解析错误的问题,觉得可以做一个过滤,提供一个encode的方法,然后回传参数的时候decode

@mzule
Copy link
Owner

mzule commented Nov 2, 2016

参数中的 / 应该在生成 url 前自行 urlencode. 如

router://main?name=wu/tong/ke
↓
 "router://main?name="+urlencode("wu/tong/ke")
↓
router://main?name=wu%2Ftong%2Fke

这样在目标 Activity 通过 getIntent().getString("name") 得到的值就已经是 wu/tong/ke 了。

@wutongke
Copy link
Author

wutongke commented Nov 2, 2016

谢谢

@mzule mzule closed this as completed Nov 2, 2016
@wutongke
Copy link
Author

wutongke commented Nov 2, 2016

发现参数编码后在生成path时
String urlPath = uri.getPath()自动进行了解码,所以还是会得到错误的path,导致解析失败。

@mzule
Copy link
Owner

mzule commented Nov 3, 2016

image

@mzule mzule reopened this Nov 3, 2016
@mzule mzule closed this as completed Nov 11, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants