Jeg har fundet følgende info på
http://livedocs.macromedia.com/jrun/4/Programmers_Guide/i10n6.htm1) Getting request encoding type:
When a browser uses a character set that is not ISO-8859-1, it is supposed to send the encoding character set in the Content-Type header of the request. You use the request object's getCharacterEncoding method to get the character set from the Content-Type header. You can use that value to decode the form data and work with the response using the correct character set.
For example, if the client submits a form using EUC-JP and sets the request's Content-Type header to Shift-JIS, the processing servlet can determine how the request was encoded and properly decode it.
Det tyder jo på, at man skal kunne fange encoding'en på en request via header informationen. Længere nede på samme side mener jeg imidlertid der står det modsatte!
2) Using setCharacterEncoding
While there is no declarative solution to determining the client's character encoding, the servlet API includes the following convenience method that sets the request object's encoding so that the remaining request data can be processed correctly:
request.setCharacterEncoding
This method lets you assign an encoding type to the request, so that all future calls to the request object decode the request's data correctly. Using setCharacterEncoding lets you avoid converting the request data from the default encoding to another encoding.
You must set the request's encoding before any calls to getParameter or getReader.
The following example sets the encoding type servlet so that Japanese parameters from a Shift_JIS-encoded form can be read with standard getParameter methods:
request.setCharacterEncoding("Shift_JIS");
String username = request.getParameter("username");
Her fremgår det, at request.setCharacterEncoding benyttes når JSP-siden skal svare på en request, og ikke når request'en sendes. Det er, som du også skriver, en hjælp til at konvertere encoding, men man skal stadig 'hardkode' den forventede request encoding! I langt de fleste tilfælde vil det også være godt nok. En måde man med større sikkerhed kan gætte request encoding'en er måske, at medsende en kendt tekststreng. Man kan så forsøge at konvertere tekststrengen med forskellige charset indtil teksten kan genkendes.