Posts Tagged ‘Ruby on Rails’

RoR 中 Prototype 的中文乱码

June 18th, 2007
Tags: , , | Posted in Web | No Comments »

今天在写 Ruby on Rails 的时候发现,AJAX 传回中文数据会出现乱码。搜索以后发现原来可以这样做。在 controller 中加入

before_filter :set_charset def set_charset @headers["Content-Type"] = 'text/html; charset=gb2312"; end

我很懒,直接写到 ApplicatiopnController 中了,搞定。

No Comments »

||