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

Fix encoding exceptions #544

Merged
merged 4 commits into from Sep 29, 2016
Merged

Fix encoding exceptions #544

merged 4 commits into from Sep 29, 2016

Conversation

pixeltrix
Copy link
Contributor

Sometimes clients aren't properly encoding UTF-8 chars as %HH chars in the request url and this was causing exceptions further down the stack. The primary source of the UTF-8 chars is the tick mark introduced in Rails 3 to force UTF-8 encoding in form submissions from IE. Since this isn't relevant anymore we can just disable the tick mark but we should also force UTF-8 encoding on the url anyway because there were other sources (mostly old links to search pages).

Seems like Android 6.0.1 in some circumstances is sending the tick
mark that Rails uses to force UTF-8 encoding as a raw character and
not as %HH encoded values as it's meant to according to the RFC.

The tick mark doesn't give us any benefit for the search forms so
it's safe to turn if off and it just pollutes the URL anyway.
We don't need the value for the submit button in the form params so
by removing the name we will force the browser not to send it and
reduce visual noise in the search urls.
Sometimes the url returned by Rack is encoded as binary due to clients
not properly encoding urls. When this url was being output as a url tag
in the Open Graph meta tags it was causing the transformation of the
output buffer from UTF-8 to binary and causing later concatenations to
blow up with an incompatible character encodings exception.
Sometime the url is returned as binary by Rack because it hasn't been
encoded properly by the client so force encoding it to UTF-8 will stop
incompatible encoding errors creeping in elsewhere.
@alanth alanth merged commit 38e8e40 into master Sep 29, 2016
@alanth alanth deleted the fix-encoding-exceptions branch September 29, 2016 06:08
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.

None yet

2 participants