-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Mark,
On 3/2/18 2:13 PM, Mark Thomas wrote: > On 02/03/18 19:01, Christopher Schultz wrote: > > <snip/> > >> Would it be better to do this instead: >> >> response.setContentType("text/plain;charset=" + >> response.getCharacterEncoding()); >> >> Even if the encoding is *supposed* to be UTF-8 (like the >> constant suggests), in case it isn't for whatever reason, we >> should use the encoding that is actually being used, instead of >> what we expect to be used. > > We should be in full control of the response so it can be any > encoding we want. Can't it? Sure, but I think it would be better if everything were self-consistent. Sure, the code is self-consistent, but it could diverge in the future. Using setContentType(getCharacterEncoding()) removes the possibility of a future bug. Also, there are filters and other things that might cause the character encoding to change to be something unexpected in this part of the code. Pulling the *actual* character encoding prevents the response from becoming inconsistent with itself. - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlqfDCMdHGNocmlzQGNo cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFjN9w//YtxZJ6vo7UMyTqMH 4lrQtjmduGVk6DzqrtKN4myRNLx5kdjtjgNprzxEUylT6o4XKtz0EDG+6NB4qzS4 oPEfS12XWzznyWGgkadNeo0azUHkbXhh8G61p/Hv2TktPnJou1mAINp9FFciMA8O aXCDoF/03JEQRe/VUivmtmzfG8cWV82DR0dpNNabK8Yfm327Zxl9Qb2UJpnaomIq u3OKJoS48Hk/d3NjN0hJZ7k+GLs7+pWwMQ/youAcGGW8BBgOnJG8HLiZKf851gS5 0J5GNg/osMmNsUmTcCBJ94q4TfAysa2oN/ZFem6RQItGdjUFyoz5JyQVHeYANQ2N Prw374Z5g+LCJpkcMoJVqBx1qv2MeVy8QYv2fcaOtOd6rSnX8wnfCGIwDDwz/u5i iXlUpOjHKwYomxmsXS9viBdEGT8fZkh14IVhrfSVL2qLOAepinmawin7Iu1Jstpq puBDiN+V0B1UJZ5IInB+GOSSSMDfk7Ub1Sa2OEl7y9Z8kqwwQ9CTrJgkMhhW08tE VpeakcXCf0dJHO8ktHJQfE5SjonEiDE3fYc7gmfYPSoFBBccixKRNZE7nSfsrCqK +TCKfAtj/GptaGEHphFe1Fbq0plD35xzI6JVB87ZQKx6uVeFFkhO21V+AlMNJjKB N5V+EJ3ueeT1NvI8TJgHU9a8LAk= =Wbfk -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org