Setting custom encoding for a single request?

Hi all,

I was wondering if it’s possible to set Rails’s output encoding for a
single request w/ Ruby 1.9?

For example, one request on my app generates a form for submission to a
third-party who mandates ISO-8859-1, and the form therefore contains
iso-8859-1 encoded strings.

Although I set the response’s content-type to ‘text/html;
charset=ISO-8859-1’, when Rails renders the output it produces a UTF-8
string (containing ISO-8859-1 characters) and then falls over with an
“ArgumentError (invalid byte sequence in UTF-8)”.

Is is possible to tell Rails "generate all output for this request in
charset x?’


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs