删除"utf8 =✓"从Rails 3表单提交 [英] Removing "utf8=✓" from Rails 3 form submissions

查看:76
本文介绍了删除"utf8 =✓"从Rails 3表单提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Rails 3应用程序中有一个简单的搜索表单:

I have a simple search form in my Rails 3 app:

<%= form_tag search_path, :method => "get" do %>
  <%= text_field_tag :q, params[:q] %>
  <%= submit_tag "search", :name => nil %>
<% end %>

当用户点击提交"按钮时,他们进入以下URL:

When the user hits the submit button, they get taken to the URL: http://myapp.com/search?utf8=%E2%9C%93&q=foobar (where %E2%9C%93 gets displayed as a checkmark: ✓).

我没有对utf8参数做任何事情,因此我想通过完全删除URL来保持URL干净.也就是说,我希望用户进入以下URL: http://myapp.com/search?q= foob​​ar .

I'm not doing anything with the utf8 parameter, so I want to keep the URL clean by removing it entirely. That is, I want users to get taken to the URL: http://myapp.com/search?q=foobar instead.

我该怎么做?

推荐答案

即使您没有对参数做任何事情,Rails也是.这是为了纠正IE参数编码中的某些问题. Yehuda在这里有更多信息:

Even though you aren't doing anything with the parameter, Rails is. It's to correct some issues in IE's parameter encoding. Yehuda has more info here:

什么是_snowman参数在Ruby on Rails 3表单中使用?

这篇关于删除"utf8 =✓"从Rails 3表单提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆