Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8276970

Default charset for PrintWriter that wraps PrintStream

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 18
    • 18
    • core-libs
    • b25
    • generic
    • generic

      This issue was raised during the conversations in the following PR:
      https://github.com/openjdk/jdk/pull/5771
      The constructors that take `OutputStream` w/o explicit charset defaults to use the `Charset.defaultCharset()` encoding. This is causing an issue if the OutputStream to wrap is a PrintStream, which holds its own charset, and it will be ignored. If those charsets differ, apps would end up specifying explicit charset on creating the PrintWriter, as in the said PR.
      This is especially problematic when PrintWriter wraps System.out/err, because with the JEP400, the default charset is now UTF-8 while standard I/O remains in `native.encoding`.

            naoto Naoto Sato
            naoto Naoto Sato
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: