Reputation: 21
I'm trying to save something as JSON, but it breaks after a Unicode character:
Obj: {
comment => "test test test £466"
}
=> to_json
results in
{
"comment":"test test test "
}
Obj.inspect
puts:
`comment => "test test test \243466"`
Any hints here?
Upvotes: 2
Views: 1303
Reputation: 2718
It sounds like Daniel has a solution using Iconv, namely:
Iconv.conv('utf-8', 'ISO-8859-1', "incoming text")
Is there another way to to this though? In another question I read that someone was having trouble with iconv on heroku
Upvotes: 1