There are two ways to specify how GET parameters are interpreted:
Set the URIEncoding attribute on the <Connector> element in server.xml to something specific (e.g. URIEncoding="UTF-8").
Set the useBodyEncodingForURI attribute on the <Connector> element in server.xml to true. This will cause the Connector to use the request body's encoding for GET parameters.
Creating BufferedReader from Files.newBufferedReader
Files.newBufferedReader(Paths.get("a.txt"), StandardCharsets.UTF_8);
when running the application it may throw the following exception:
java.nio.charset.MalformedInputException: Input length = 1
But
new BufferedReader(new InputStreamReader(new FileInputStream("a.txt"),"utf-8"));
works well.
The different is that, the former uses CharsetDecoder default action.
The default action for malformed-input and unmappable-character errors is to report them.
while the latter uses the REPLACE action.
cs.newDecoder().onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE)
P. Bhowmik, S. Pradhan, und M. Prakash. International Journal of Applied Control, Electrical and Electronics Engineering (IJACEEE), 1 (1):
01-18(Mai 2013)
P. Bhowmik, S. Pradhan, und M. Prakash. The International Journal of Applied Control, Electrical and Electronics Engineering (IJACEEE), 1 (1):
1-18(Mai 2013)
N. Combaret, und H. Talbot. Proceedings of ISMM 2007, 2, Seite 25--26. São José dos Campos, Universidade de São Paulo (USP), Instituto Nacional de Pesquisas Espaciais (INPE), (Oktober 2007)