Skip to content

Conversation

WangEn
Copy link

@WangEn WangEn commented Sep 16, 2025

使用CharacterSet.urlQueryAllowed规则处理时,url中包含+符号时不会被按照预期进行编码,导致contentTypeapplication/x-www-form-urlencoded时,经过uni.request发送到服务端的请求url中+被转换为空格

private percentEscapedString(str : string) : string {
    //如果url已经有部分经过encode,那么需要先decode再encode。
    return str.removingPercentEncoding?.addingPercentEncoding(withAllowedCharacters = CharacterSet.urlQueryAllowed) ?? str
}

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

Successfully merging this pull request may close these issues.

1 participant