So, here's the picture as far as I can tell..

The only way to send multi-byte utf8 characters in their raw form
without them being urlencoded is to use a POST with Content-Type
'multipart/form-data'.

Common browser behaviour for POSTing forms with this Content-Type (in
a non-AJAX context) is to split out each form field and add a boundary
separator between them. Character encoding follows the standard
policies regarding whatever page encoding / Accept-Encoding header
rules are relevant. This seems pretty reliable across IE/FF/GC/Safari.
So, long and short is, for non-AJAX forms, your utf8 multi-byte
characters get through to the server ok without being urlencoded.

Conversely, Prototype does not rig all this boundary stuff up for us
if we switch to 'multipart/form-data', although it could be made to do
so if it was deemed a useful addition (see 
http://dev.rubyonrails.org/ticket/4613).
Instead, Prototype just uses 'application/x-www-form-urlencoded' by
default, unless we tell it different, and data is always urlencoded
unless we manually over-write the postBody ourselves.

So, looks like the only options for getting utf8 field values through
to the server in-tact via Prototype's Ajax are:

- subclass or patch Ajax.Request etc to manually add multipart
boundaries
- do something on the server-side to rescue urlencoded/decoded multi-
byte characters back into utf8

So my questions would be...

- How do people generally work around this type of problem in a
internationalized (fully utf8 on server and client sides) LAMP
context?
- Is the case completely closed on building something with 'multipart/
form-data' and boundaries into Prototype? I know it's never gonna help
with file uploads, as JS can't get at that stuff, but is that reason
enough to do nothing at all?
- Would building something to handle this into Prototype open the
floodgates for lots of other similar implementation-specifics for
different Content-Types?

Jonny

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to