We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
URLFormEncoder should be encoding characters like $, but does not
4.92.5
macOS 14.3
5.9.0
let form = ["hello": "world$"] let encoder = try ContentConfiguration.global.requireEncoder(for: .urlEncodedForm) var buffer = ByteBuffer() var headers = HTTPHeaders() try encoder.encode(form, to: &buffer, headers: &headers) print(String(bytes: ByteBufferView(buffer), encoding: .utf8)!)
This should print hello=world%24. Instead, it prints hello=world$.
hello=world%24
hello=world$
According to Wikipedia, the reserved characters include $ and should be percent-escaped.
$
The text was updated successfully, but these errors were encountered:
I believe that this CharacterSet is not excluding all the characters it should be.
Sorry, something went wrong.
Ok me and @gwynne did some diving into this and it's definitely a bug - I have no idea how it's been undiscovered this long. There doesn't appear to be a good actual RFC spec to refer to, but the best we've found is https://url.spec.whatwg.org/#application-x-www-form-urlencoded-percent-encode-set
The application/x-www-form-urlencoded percent-encode set contains all code points, except the ASCII alphanumeric, U+002A (*), U+002D (-), U+002E (.), and U+005F (_).
U+002A
*
U+002D
-
U+002E
.
U+005F
_
Will schedule a fix for this asap
Successfully merging a pull request may close this issue.
Describe the issue
URLFormEncoder should be encoding characters like $, but does not
Vapor version
4.92.5
Operating system and version
macOS 14.3
Swift version
5.9.0
Steps to reproduce
Outcome
This should print
hello=world%24
. Instead, it printshello=world$
.Additional notes
According to Wikipedia, the reserved characters include
$
and should be percent-escaped.The text was updated successfully, but these errors were encountered: