Rails 3 UTF-8 query string showing up in URL? Rails 3 UTF-8 query string showing up in URL? ruby-on-rails ruby-on-rails

Rails 3 UTF-8 query string showing up in URL?


The utf8 parameter (formerly known as snowman) is a Rails 3 workaround for an Internet Explorer bug.

The short answer is that Internet Explorer ignores POST data UTF8 encoding unless at least one UTF8 char is included in the POST data. For this reason, Rails injects an UTF8 character in the form to force IE to treat everything as UTF8 encoded.


This parameter is a new feature of rails 3.

It was previously the snowman.

It helps IE to really use utf-8.

Avoid using form_tag and it works:

<form action="<%= search_path %>" method="get" >  <%= text_field_tag 'query' %>  <%= submit_tag "Search", :name => nil%></form> 


form_tag in Rails 4.2 (and probably earlier) has a :enforce_utf8 option;

If set to false, a hidden input with name utf8 is not output.