On Fri, Feb 25, 2011 at 3:37 PM, Alexander Klimetschek <[email protected]> wrote: > On 25.02.11 11:43, "Markus Joschko" <[email protected]> wrote: >>Nevertheless I wonder why it is necessary to include a mandatory >>parameter with always the same value. >>Can't this be done by sling? > > Yes, but it must match the value of the response of the previous request > (i.e. the html containing the form). Because this is the character > encoding that all browsers will use to construct the form - the problem is > only that they don't explicitly mention that in the request. > > So it depends what character encoding the servlet or jsp is using to build > the html in the first place, hence by making it "global" on the input side > (you can't easily make output in utf-8 a global setting for all > servlets/jsps), you could run into issues. That's why the typical approach > settled on explicitly including the _charset_ parameter - because that one > is written in the code that is also setting the response output encoding.
Not sure if I get this correctly. I understand that I (the application developer) know which encoding I chose for the HTML pages (otherwise I could not write the _charset_ field anyway). If I choose the same encoding for all my forms I could easily set default/fallback encoding which sling can use when no _charset_ field is explicitly provided. Seems to be much more convenient then always writing the field or adding a filter that does that.
