Search code examples
unicoderequestramaze

Ramaze Request Parameters in Unicode?


I've got a partial for rendering a form that is throwing an error using unicode; I've narrowed the error down to the line;

<input name='q' value='#{request.params['q']}' />

If I go to localhost/thepath?q=中文 it throws

Encoding::CompatibilityError at /thepath/
incompatible character encodings: ASCII-8BIT and UTF-8

But

<input name='q' value='中文' />

Works fine, and all the unicode strings from values that aren't in the request work fine also.


Solution

  • One solution is to wash the input with #force_encoding, is there a more desirable method?