Process Unicode POST request

Hi all,

I'm building a Rails controller which receives a POST request from an external (Windows) application in order to communicate data. The content of this POST request is encoded using Unicode. I know Ruby doesn't support Unicode, but I was wondering if there was a way to still properly process such a request.

A simple POST request containing "a=b" as data, *with* Unicode translates into:

=== start req === POST /post/batch HTTP/1.1 Content-Type: application/x-www-form-urlencoded User-Agent: Test/1.0 Host: 127.0.0.1:3000 Content-Length: 6 Cache-Control: no-cache Cookie: _session_id=adb54e68cd96c44b4758209c8946c921

a.=.b. === end req ===

As you'd expect with Unicode encoding, "a" is now translated in multiple bytes "a.", just like "=" and "b".

The YAML::dump(params) for this request is as follows:

--- !map:HashWithIndifferentAccess action: batch controller: post ? !binary "YQA=\n" : !binary |   AGI=

Which is obviously not what I'd expected.

To prove it does work without Unicode, the same POST request *without* Unicode translates into:

=== start req === POST /post/batch HTTP/1.1 Content-Type: application/x-www-form-urlencoded User-Agent: Test/1.0 Host: 127.0.0.1:3000 Content-Length: 3 Cache-Control: no-cache

a=b === end req ===

The YAML::dump(params) for this request is as follows:

--- !map:HashWithIndifferentAccess action: batch controller: post

So my question is: does anyone know how to make this work properly with Unicode? The Rails version I'm using for this application is 1.2.2, so with $KCODE automatically set to UTF-8.

Thanks in advance, Wouter