2013年11月27日

rails 中文乱码

摘要: ruby 1.9.3 rails 3.2.6mysql2mysql记录里面包含中文字符的时候,在页面上显示乱码;尝试了在所有controller合model文件的第一行加上# encoding: utf-8在 .html.erb文件里面加在 ApplicationController里面加上:before_filter :set_charsetdef set_charset @headers["Content-Type"] = "text/html; charset=utf-8"end将所有.erb.html文件编码改称utf-8iconv -f asc 阅读全文

posted @ 2013-11-27 11:28 red_goal 阅读(280) 评论(0) 推荐(0)

导航