Details
-
Bug
-
Status: Done
-
Minor
-
Resolution: Done
-
None
-
None
Description
During work on METRON-612, I noticed a lot of our warnings are from implicit use of the default Charset (e.g. when creating InputStreamReaders). Given that this value is platform dependent, we should at least consider explicitly using a particular Charset.
In addition, after fixing this, I would like to see it upgraded to a compile error, because in my experience almost everyone tends to use methods that use the implicit default Charset. This can be done by changing the compiler arg in the pom to instead be
<compilerArgs> <arg>-Xlint:unchecked</arg> <arg>-Xep:DefaultCharset:ERROR</arg> </compilerArgs>
My assumption is that we'll want UTF-8, but given a lack of expertise and that usually there's a lot of opinions on character set issues, we may want to consider other options.
http://errorprone.info/bugpattern/DefaultCharset
https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html lists standard Charsets and provides more details.
Charset Description US-ASCII Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set ISO-8859-1 ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1 UTF-8 Eight-bit UCS Transformation Format UTF-16BE Sixteen-bit UCS Transformation Format, big-endian byte order UTF-16LE Sixteen-bit UCS Transformation Format, little-endian byte order UTF-16 Sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order mark
Attachments
Issue Links
- links to