RAILS JSON + EXTJS上的西里尔字符转义问题

时间:2011-06-06 10:48:28

标签: ruby-on-rails json extjs

我在rails JSON输出中转义西里尔字符时出现问题:

{"success":true,"total":"2","offices":[{"address":"addr","created_at":"2011-06-03T11:55:09Z","description":"desc","id":1,"name":"Office 1","published":true,"updated_at":"2011-06-05T13:48:35Z"},{"address":"\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd","created_at":"2011-06-03T12:32:19Z","description":"\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd","id":2,"name":"\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd 2","published":null,"updated_at":"2011-06-05T13:49:51Z"}]}

它们未在EXTJS中正确解码,导致网格为 2

页面编码为UTF8。 Mysql和Rails配置设置为UTF8

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

任何代码? 我只看到你的角色已经在json输出中扭曲了(如果你仔细看看它们都是一样的 - “\ ufffd \ ufffd \ ufffd \ ufffd \ ufffd \ ufffd”)。