查询 mysql DB 时 Rails 4 中的编码错误
Encoding error in Rails 4 when querying mysql DB
在某些情况下,我在查询位于 aws 服务器 (mysql) 上的数据库时收到此错误。我将数据库配置为 utf8,并在 config/application.rb 文件中将 rails 应用设置为 utf-8。有什么建议吗?
AwsCourse Load (36.5ms) SELECT COURSE
.* FROM COURSE
WHERE COURSE
.id
IN (6, 1, 3, 5 , 4, 2)
在 128 毫秒内完成 500 个内部服务器错误(ActiveRecord:36.5 毫秒)
Encoding::UndefinedConversionError ("\xC2" from ASCII-8BIT to UTF-8):
app/controllers/welcome_controller.rb:22:in `course_search'
其中一个数据库条目中存在非 UTF8 字符。感谢@muistoshort 为我指明了正确的方向。
在某些情况下,我在查询位于 aws 服务器 (mysql) 上的数据库时收到此错误。我将数据库配置为 utf8,并在 config/application.rb 文件中将 rails 应用设置为 utf-8。有什么建议吗?
AwsCourse Load (36.5ms) SELECT COURSE
.* FROM COURSE
WHERE COURSE
.id
IN (6, 1, 3, 5 , 4, 2)
在 128 毫秒内完成 500 个内部服务器错误(ActiveRecord:36.5 毫秒)
Encoding::UndefinedConversionError ("\xC2" from ASCII-8BIT to UTF-8):
app/controllers/welcome_controller.rb:22:in `course_search'
其中一个数据库条目中存在非 UTF8 字符。感谢@muistoshort 为我指明了正确的方向。