Ajax call and latin1?

Hi.

I use a form_remote_tag and use latin1 in mysql and rails. But the
ajax call send utf8 and not latin1.
Anyone knows a way to change that ?

Thanks.

I use a form_remote_tag and use latin1 in mysql and rails. But the
ajax call send utf8 and not latin1.
Anyone knows a way to change that ?

Ok I feel bad, it’s out there already:
http://dema.ruby.com.br/articles/2005/07/22/playing-nice-with-ajax-and-iso-8859-1

For list archive :

require ‘iconv’
class ApplicationController < ActionController::Base
before_filter :convert_xhr

ICONV = Iconv.new(‘ISO-8859-1’, ‘UTF-8’)

def convert_xhr
convert_hash(params) if request.xhr?
end

def convert_hash(hash)
for k, v in hash
case v
when String: hash[k] = ICONV.iconv(v)
when Array: hash[k] = v.collect { |v| ICONV.iconv(v) }
when Hash: convert_hash(v)
end
end
end