Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

url参数包含中文,利用 requestId 生成新的 url就会有问题 #65

Open
firecolen opened this issue Apr 1, 2021 · 5 comments

Comments

@firecolen
Copy link

//利用 requestId 生成新的 url
_KKJSBridgeXHR.generateNewUrlWithRequestId = function (url, requestId) {
...
var search = aTag.search ? aTag.search : "";
...
url = orignAction.replace(search, "").replace(hash, "");
.....
var newAction = url + aTag.search + aTag.hash;
return newAction;
};

如果url的参数包含中文,search拿到的是编码后的数据,replace替换方法就不起作用,客户端拿到的url就存在2个?

@karosLi
Copy link
Owner

karosLi commented Apr 2, 2021

你是 POST 包含中文参数?

@firecolen
Copy link
Author

GET请求,例如http://aa.com?city=北京

@karosLi
Copy link
Owner

karosLi commented Apr 2, 2021

你有试过 URLEncode 吗

@firecolen
Copy link
Author

用URLEncode可以解决问题,但是旧项目很多地方存在这种请求,只能在KKJSBridgeAJAXProtocolHook.js统一处理,
var orignAction = encodeURI(decodeURI(url));
这样是否能解决问题呢?

1 similar comment
@firecolen
Copy link
Author

用URLEncode可以解决问题,但是旧项目很多地方存在这种请求,只能在KKJSBridgeAJAXProtocolHook.js统一处理,
var orignAction = encodeURI(decodeURI(url));
这样是否能解决问题呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants