-
Notifications
You must be signed in to change notification settings - Fork 520
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
Params middleware does not decode some strings correctly #269
Comments
Thanks for the feedback! It's odd that the Java URLDecoder doesn't work for the Shift-JIS charset. If the Commons URLCodec works better, and there's no other side effects, then I think we should swap to that in the Ring-Codec library. It already depends on the commons-codec library, so I don't think there should be any disadvantage to it. I've done some quick benchmarks, and commons-codec seems about twice as fast decoding anyway. |
Looks like it'll take a bit of work to update the Ring-Codec library. As well as the URLDecoder, Ring-Codec has its own custom implementation for percent encoding that suffers from the same issue. |
Thanks for taking a look at this! |
- This addresses the following URLdecoding issue ring-clojure/ring#269
- This addresses the following URLdecoding issue ring-clojure/ring#269
I took a while that the scope of the issue is in ring-codec. |
I have faced a similar issue where Calling |
Hi James, thanks for the continued work on maintaining ring.
Just want to throw this issue out there in case anyone else stumbles upon the same issue, plus gathering some feedback.
In our project, we were dealing with non utf-8 encoded forms (Shift_JIS to be specific), and found that the params middleware is garbling the incoming string, even though we were using the wrap-params middleware with the Shift_JIS option e.g. (param/wrap-params {:encoding "Shift_JIS"})
Looking at the source code deeper inside, I see that java.net.URLDecoder is being used for parsing, and that java.net.URLDecoder does not decode some non utf-8 strings correctly, while org.apache.commons.codec.net.URLCodec can, illustrated in below snippet.
We came up with 2 work arounds for this issue:
Would appreciate the if I can get feed back on:
Thanks!
The text was updated successfully, but these errors were encountered: