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

查看:26
本文介绍了删除“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:http://myapp.com/search?utf8=%E2%9C%93&q=foobar(其中 %E2%9C%93 显示为复选标记:✓).

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: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天全站免登陆