-
-
Notifications
You must be signed in to change notification settings - Fork 727
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
why does urlencoded charset must be utf-8? #237
Comments
So it's just not yet a completed implementation. In order to determine the charset of the contents, the spec https://www.w3.org/TR/html5/forms.html#url-encoded-form-data spells out the steps to do this. UTF-8 is the specified default value, so it's the only value supported right now until the steps are implemented. |
thanks for the answer @dougwilson. so basically if you remove check then there are cases when charset cannot be determined reliably, according to the specs that is? do you maybe an have idea when other charsets will be supported? |
Hi @rodic normally, that type will never have a I'm not working on implementing it, so you're welcome to. Remember that that charset is not the spec for what goes to |
@dougwilson i have an issue with api that is implemented with callbacks. when they send data they set charset in the header to i'll take a look at the issue when i find time. on the first glance it seems that roughly we would have to decode body with charset from header if it is set or "utf8" otherwise. then if |
@rodic is that Paysafecard payment callbacks by any chance? having the same issue The header being sent to me is:
I believe you're saying there isn't a spec for how to detect it, but what if the header explicitly states what charset it is and you don't need detection. Could it be allowed through then? Using https://github.com/ds300/patch-package you can get around it like so: patches/body-parser+1.18.3.patch
Hope it helps someone else |
Had the same problem with my Paysafecard API they were sending request with charset "ISO-8859-1" Solved it by just placing this route handler above bodyparser middleware so its not used here |
I've the same problem with |
What you mean by placing above bodyParser? its sending a request with |
not wrong, but crashes destination if expressjs/body-parser#237 e.g. https://github.com/opengovsg/mockpass
looks like there's an unnecessary charset check in
lib/types/urlencoded.js
?that value is eventually passed to
read
fn (defined inlib/read.js
) which can work with encodings other than utf-8 as long as they are supported by iconvThe text was updated successfully, but these errors were encountered: