Where to get “UTF-8” string literal in Java?

前端 未结 11 849
谎友^
谎友^ 2020-12-02 03:51

I\'m trying to use a constant instead of a string literal in this piece of code:

new InputStreamReader(new FileInputStream(file), \"UTF-8\")
<
11条回答
  •  星月不相逢
    2020-12-02 04:42

    This constant is available (among others as: UTF-16, US-ASCII, etc.) in the class org.apache.commons.codec.CharEncoding as well.

提交回复
热议问题