rails的中文问题一直是初学者常遇到的问题之一
除了网站常见的mysql中文显示问题
今天我就遇到了rails文档显示的问题
按网上的说法改在utf-8也没有解决问题,后来改用gb2312也不行
最后还是字符集的问题,改成了GBK
代码如下:
在application.rb中加入:
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
#中文显示问题
before_filter :set_charset
def set_charset
@headers["Content-Type"] = "text/html; charset=GBK"
end
解决字符集问题


