You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where is the encoding set? Because if this is just syntactic sugar for new PrintWriter(new OutputStreamWriter(new FileOutputStream("yesss.txt"))) then you are leaving the encoding up to chance - silently a default will be used. This default depends on system settings, JVM versions and platform, and it can vary from an ASCII-only encoding on Windows (which will ruin all kinds of UTF-8 files!) to UTF-16 on some exotic platforms. It is therefore recommended to use an explicit encoding.
To do so, the OutputStreamWriter (and its cousin InputStreamReader) constructors are overloaded to accept either an additional Charset, CharsetDecoder or a string identifying the encoding. Making the encoding required in your builders would thus be a serious step forward to make it plain obvious that you can't do without.
Building a library which makes it easier to do things right than do things wrong is always strongly recommended.
The text was updated successfully, but these errors were encountered:
While I'm afraid I might not immediately use this library, I spotted the following example in the README:
Where is the encoding set? Because if this is just syntactic sugar for
new PrintWriter(new OutputStreamWriter(new FileOutputStream("yesss.txt")))
then you are leaving the encoding up to chance - silently a default will be used. This default depends on system settings, JVM versions and platform, and it can vary from an ASCII-only encoding on Windows (which will ruin all kinds of UTF-8 files!) to UTF-16 on some exotic platforms. It is therefore recommended to use an explicit encoding.To do so, the
OutputStreamWriter
(and its cousinInputStreamReader
) constructors are overloaded to accept either an additionalCharset
,CharsetDecoder
or a string identifying the encoding. Making the encoding required in your builders would thus be a serious step forward to make it plain obvious that you can't do without.Building a library which makes it easier to do things right than do things wrong is always strongly recommended.
The text was updated successfully, but these errors were encountered: