You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Roman Puchkovskiy (Jira)" <ji...@apache.org> on 2022/02/02 10:26:00 UTC

[jira] [Created] (IGNITE-16445) Always specify charset explicitly

Roman Puchkovskiy created IGNITE-16445:
------------------------------------------

             Summary: Always specify charset explicitly
                 Key: IGNITE-16445
                 URL: https://issues.apache.org/jira/browse/IGNITE-16445
             Project: Ignite
          Issue Type: Improvement
          Components: general
            Reporter: Roman Puchkovskiy
            Assignee: Roman Puchkovskiy
             Fix For: 3.0.0-alpha5


Calls like new String(byte[]), String#getBytes() and others that implicitly use default charset are dangerous because we never know what charset is chosen as a default for this particular JVM.

Even when the text we are encoding only contains ASCII characters, it could be encoded differently by some charsets (like cp1140).

We could always mandate 'specify -Dfile.encoding=utf-8 when launching a JVM', but it would make deployment a little bit difficult as the setting could be easily overlooked.

It seems not too hard to always specify a charset in the code.

For the cases when it is the correct thing to use the system default charset, it can be passed directly using Charset.defaultCharset().

To make sure that we not forget it somewhere accidentally, we could use a tool like Maven Modernizer plugin.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)