If you set a page’s character encoding using the JSP contentType page directive, the data submitted through a form on the page might not have the same encoding. For example, it might be determined by the user’s specified locale. Typically, you use the EncodingTyper component to specify the converter for data that a user enters through a form, as described in Converting Posted Data with the EncodingTyper. However, assuming you use the Dynamo request wrapper to retrieve your form data, you can specify the encoding for the form data in the page itself by including a hidden "_dyncharset" input tag. For example:

<input type="hidden" name="_dyncharset"
    value="<%=response.getCharacterEncoding() %>">

When the form is submitted, the specified charset is used to convert the data back into Unicode.

Note: If you use dsp:input tags, you do not need to specify the "_dyncharset" tag; the command is generated automatically. You need to specify the tag only if you use non-DSP <input> tags.

loading table of contents...