Skip to content

Commit

Permalink
Stop (unnecessarily) enforcing UTF8 for set_locale form
Browse files Browse the repository at this point in the history
Doing so provides us with no advantages, and has the side effect of
triggering [this bug](rack/rack#673) in Rack
when said form is submitted in browsers that do not support UTF-8

Note that that enforcement is intended as a protection against
users submitting Latin-1 values when we expect unicode; since this form
supports no user-provided values and doesn't persist any data, that's
not an issue we need to worry about.

Note also that the only browsers for which this error is likely to be
generated are browsers that we do not officially support, so an argument
could be made for simply ignoring this error. But, I figure, I already
got the fix right here.
  • Loading branch information
Hamms committed Mar 21, 2017
1 parent 957d71e commit ba29951
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dashboard/app/helpers/locale_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def serve_fonts?
end

def i18n_dropdown
form_tag(locale_url, method: :post, id: 'localeForm', style: 'margin-bottom: 0px;') do
form_tag(locale_url, method: :post, id: 'localeForm', style: 'margin-bottom: 0px;', enforce_utf8: false) do
(hidden_field_tag :return_to, request.url) + (select_tag :locale, options_for_select(options_for_locale_select, locale), onchange: 'this.form.submit();')
end
end
Expand Down
2 changes: 1 addition & 1 deletion dashboard/app/views/layouts/_footer.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

.span3{style: 'text-align: right;' + (full_width ? 'width: 140px; margin-left: 0px' : '')}

= form_tag(locale_url, method: :post, id: 'localeForm', style: 'margin-bottom: 0px;') do
= form_tag(locale_url, method: :post, id: 'localeForm', style: 'margin-bottom: 0px;', enforce_utf8: false) do
= hidden_field_tag :return_to, request.url
= select_tag :locale, options_for_select(options_for_locale_select, locale), onchange: 'this.form.submit();'
%small.dim
Expand Down

0 comments on commit ba29951

Please sign in to comment.