JSON encoding wrongly escaped (Rails 3, Ruby 1.9.2)

后端 未结 7 1352
醉梦人生
醉梦人生 2020-12-01 08:14

In my controller, the following works (prints \"oké\")

puts obj.inspect

But this doesn\'t (renders \"ok\\u00e9\")

render :j         


        
相关标签:
7条回答
  • 2020-12-01 09:00

    Characters were not escaped to unicode with the other methods in Rails2.3.11/Ruby1.8 so I used the following:

    render :json => JSON::dump(obj)
    
    0 讨论(0)
提交回复
热议问题