Charset and POST request
- by jriff
Hi All!
I have a Rails 2.3.5 application that is working fine with UTF-8 and international characters. Now I have made some integration to a payment gateway where I POST some data, wait a while and get a POST back. The problem is that when I get that post back the international characters are broken. Instead of "sørensen" I get: "sørensen". If I do an iconv -fISO-8859-1 -tUTF8 it gets correctly converted to the former (I do that from a OS X command prompt). I have examined the POST request with logger.info(request.headers.inspect) in my controller and I can see that no charset parameter is given.
As far as I can see the POST from the gateway must be UTF8 since one character (ø) gets translated to two (ø). So why does Rails think that the POST is ISO-8859-1?
I know that one solution is to simply convert the params-hash with Iconv in the controller but I would like to know what is happening.
Thanks in advance.
Regards,
Jacob