cushon / issues-import

0 stars 0 forks source link

Warn/Error on InputStreamReader.InputStreamReader(InputStream in) and OutputStreamWriter.OutputStreamWriter(OutputStream out) #171

Open cushon opened 9 years ago

cushon commented 9 years ago

Original issue created by gladfelter@google.com on 2013-08-09 at 09:49 PM


And any other constructors/factory methods that rely on platform-default encoding/decoding. That is almost never what you want in production code. You normally know what character set the input data is in and it is rare in production code that f(platform) is surjective on desired encoding.

cushon commented 9 years ago

Original comment posted by kevinb@google.com on 2013-10-01 at 04:44 PM


This is a good candidate for the "multiple suggested fixes" feature. One suggested fix should always be StandardCharsets.UTF_8 (well, if you're on JDK 7). Another would be to pass Charset.defaultCharset() explicitly, which is what command-line tools would probably want.