May
19

还是中文的问题,在?传递中文参数时请使用encodeURIComponent.

document.write(encodeURIComponent(”中文”));   =>  %E4%B8%AD%E6%96%87
document.write(escape(”中文”));                           =>  %u4E2D%u6587

Rails 能自动 decode 使用encodeURIComponent的编码,但不能对javascript escape的中文进行unescape.CGI.escape和CGI.unescape方法编码是以GBK方式编码中文的,而javascript的escape和unescape是utf-8方式。

Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg

Tags:

No Responses

Leave a Response

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>