·Make sureconfig.encoding = "utf-8"is in the application.rb file.
·Make sure you are using the 'mysql2' gem.
·Put# encoding: utf-8at the top of file containing UTF-8characters.
·Above the<App Name>::Application.initialize!line in the environment.rb file, addfollowing two lines:
·Encoding.default_external= Encoding::UTF_8
Encoding.default_internal= Encoding::UTF_8
设置了红色字体的就好用了
转载于:https://blog.51cto.com/qihoushangshu/1320648