Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a search query form on my home page (/)

<% form_tag(search_path, :method => :get) do %>
  <%= text_field_tag 'query' %>
  <%= submit_tag "Search", :name => nil%>

<% end %>

When I submit this search form, I want to end up at (/search?query=foo). However, right now I get /search?utf8=%E2%9C%93&query=foo. What's that utf8 parameter doing there? How can I get rid of it?

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
200 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...