Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array. The behavior of this method when this string cannot be encoded in the default charset is unspecified.
https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#getBytes--
Since this is a distributed system, it is always possible that different nodes have different default charsets defined. I think it's most safe to specify it explicitly across all nodes for safety sake. You could for example see a situation where an upgrade JVM uses a different default and during a rolling upgrade of the JVM, different nodes now have a different default.
- The default charset is usually "ISO-8859-1". UTF-8 covers more of our international friends.
- Explicitly specifying the CharSet yields slight performance gains
- Explicitly specifying the CharSet removes the need for try/catch blocks of UnsupportedEncodingException
https://blog.codecentric.de/en/2014/04/faster-cleaner-code-since-java-7/
Attachments
Issue Links
- links to