Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'd argue that we can do much better than that... why aren't the guaranteed-to-be-available charsets accessible directly? <code>Charset.UTF8</code> should be a reference to the <code>Charset</code>, not the name as a string. That way we wouldn't have to handle <code>UnsupportedEncodingException</code> all over the place.</p> <p>Mind you, I also think that .NET chose a better strategy by defaulting to UTF-8 everywhere. It then screwed up by naming the "operating system default" encoding property simply <code>Encoding.Default</code> - which <em>isn't</em> the default within .NET itself :(</p> <p>Back to ranting about Java's charset support - why isn't there a constructor for <code>FileWriter</code>/<code>FileReader</code> which takes a <code>Charset</code>? Basically those are almost useless classes due to that restriction - you almost always need an <code>InputStreamReader</code> around a <code>FileInputStream</code>or the equivalent for output :(</p> <p>Nurse, nurse - where's my medicine?</p> <p>EDIT: It occurs to me that this hasn't really answered the question. The real answer is presumably either "nobody involved thought of it" or "somebody involved thought it was a bad idea." I would strongly suggest that in-house utility classes providing the names or charsets avoid duplication around the codebase... Or you could just use <a href="https://github.com/google/guava/blob/master/guava/src/com/google/common/base/Charsets.java" rel="nofollow noreferrer">the one that we used at Google when this answer was first written</a>. (Note that as of Java 7, you'd just use <a href="https://docs.oracle.com/javase/10/docs/api/java/nio/charset/StandardCharsets.html" rel="nofollow noreferrer"><code>StandardCharsets</code></a> instead.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload