code: private PrintWriter getWriter(OutputStream os) throws IOException {
          if (os instanceof WrapperOutputStream) {
              OutputStream out = ((WrapperOutputStream) os).unwrapRecursively();
              if (out instanceof FilteredOutputStream) {
                  FilteredOutputStream filteredStream = (FilteredOutputStream) out;
                  return new PrintWriter(new IgnoreCloseWriter(filteredStream.asWriter()));
              }
          }
          return new PrintWriter(new BufferedWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8)));
      }
docs: When anonymization is enabled, we create an {@link com.cloudbees.jenkins.support.filter.FilteredWriter} directly from
  the underlying {@link FilteredOutputStream} that prevents us from encoding and
  then immediately decoding characters written to the returned {@link java.io.PrintStream}
  when filtering.