How to specify ActiveRecord's to_json encoding

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 to_json() or to_xml() methods?

Problem: We have some multibyte characters in our database. For example we have a table with a name column that has this French accented e: Café Records. When we serialize this object using ActiveRecord's to_xml() everything looks fine in the browser. When we render JSON using to_json() we are seeing problems where the accented 'e' character is getting mangled and causes our calling web client to fail since it's expecting properly UTF-8 encoded characters.

If we use the browser to submit HTTP Get requesting JSON format, save the file and view it in binary mode in Hexadecimal representation, this is what we get. It looks like this is using extended ASCII.

Bytes Text 43 61 66 E9 C a f (should be accented e)

If we save that same file from above and specify UTF-8, we get an extra byte that seems to be proper UTF-8 encoding as shown below.

Bytes Text 43 61 66 C3 A9 C a f (should be accented e)

Can someone tell me how they've made to_json() UTF-8 compliant? Thanks in advance, Calvin.