From: Brian Candler Date: 2009-08-11T05:39:07+09:00 Subject: Re: ActiveRecord to_json encoding Calvin Nguyen wrote: > > Question: > Hi, our company is using Ruby 1.8.6 with Rails 2.2.2. Does anyone > know we can explicitly specify what encoding to use when calling Answer: Yes, almost certainly someone does. But you will be more likely to find them on a Rails mailing list. This is the mailing list for Ruby, the programming language. If you install ruby 1.9 somewhere, it has some features you can use to experiment with encodings. For example: $ irb19 --simple-prompt >> str = "Caf辿" => "Caf辿" >> str.bytes.map { |x| "%02x" % x } => ["43", "61", "66", "c3", "a9"] >> str.encode!("ISO-8859-1") => "Caf >> str.bytes.map { |x| "%02x" % x } => ["43", "61", "66", "e9"] >> But I suggest you keep your 1.8.6 for production use. -- Posted via http://www.ruby-forum.com/.