Hi Felix,

The core problem is, that the browsers generally do not send the
Cotent-Type header with the proper charset parameter. Instead they tend to encode the form post using the same encoding as was used for the HTML
on which the form resides.

Yes, that's the browser's problem.

So if you send the form with

  Content-Type: text/hml; charset=UTF-8

My form really can't be that content type, especially in an ajax request.

the POST is sent back encoded in UTF-8 and Sling will happily decode as
UTF-8 as instructed by the _charset_ parameter.

For best (and proven) results:

 * Send everything as UTF-8
 * Use encoding="multipart/form-data" for your forms
 * Keep the _charset_ parameter set to UTF-8 (or utf-8)

Yes, that's what I do. It doesn't work when using dojo ajax post in ie(When I use dojo in ie do the ajax post, sling didn't get the encoding, so it use iso-8859-1 as default).

Besides, if sling fix the encoding for the request parameter, then ContainerRequestParameter's encoding and decoding really seems unnecessary. Even everything is right, decoded every parameter value in utf-8 then encode it with the same encoding again is an unnecessary waste.

Thanks for you reply.

-----
Jack



Reply via email to