I agree that the best place would be Merb::Rack::Application where I
thought we could do it. What stopped me from doing that is that the
Multipart POST will arrive as rack.input which is an String::IO. And
I'm not that sure that changing the whole rack.input encoding to
Encoding.default_external would not break things. This was actually
solution in the Rack Lighthouse which was dropped due to this fear.

Also in theory each part of the Multipart post can have different
encoding AFAIK which makes things even more complicated. Or am I wrong
here?

It's worth trying though.

Pavel

On Apr 11, 6:34 pm, [email protected] wrote:
> Hi,
>
> On Apr 11, 2011 12:25am, Pavel Kunc <[email protected]> wrote:
>
> > This has been problem for loooong time and we have been forced to do
> > crazy things. While Rack is in development it goes slow and some
> > patches including patch for support of Encoding in Ruby 1.9.x are
> > still not there.
> > The result is that what comes from Rack is not what you might expect
> > and that leads to nasty exceptions about incompatible encoding as we
> > all know them. It happen during POST, sometimes get and so on.
>
> There's a bit in the Rack specs:
>
> "The input stream is an IO-like object which contains the raw HTTP POST  
> data. When applicable, its external encoding must be “ASCII-8BIT” and it  
> must be opened in binary mode, for Ruby 1.9 compatibility."
>
> http://rack.rubyforge.org/doc/SPEC.html
>
> So the external (and internal) encoding of the input object given by Rack  
> could be set in the Rack stack when using Ruby 1.9 as long as it is  
> a "proper enough" IO, or wrapped so that the mandatory methods deliver  
> ASCII..UTF-8. The spec still has a bunch of holes regarding it, but  
> handling that and the encoding of the environment variables in  
> Merb::Rack::Application before it even hits the dispatcher sounds good to  
> me.

-- 
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/merb?hl=en.

Reply via email to