Uploaded image for project: 'Abdera'
  1. Abdera
  2. ABDERA-145

PrettyWriter uses default system charset when no specified, but should use UTF-8 or charset of doc.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.3.0, 0.4.0
    • 1.0
    • None

    Description

      I see that when using PrettyWriter my code does not renders multilingual content correctly, (even when I set charsets explicitly in document)
      When there is no charset in document UTF-8 is assumed (and this default will suit any content Chinese, Russian, etc.),
      I would expect
      that PrerryWriter should also assume UTF-8 when no one is set explicitly
      – OR –
      that PrettyWriter will look into passed document and get charset from there...

      but
      public void writeTo(
      Base base,
      OutputStream out,
      WriterOptions options)
      throws IOException {
      out = getCompressedOutputStream(out, options);
      String charset = options.getCharset();
      if (charset != null)

      { writeTo(base,new OutputStreamWriter(out,charset),options); }

      else

      { writeTo(base,new OutputStreamWriter(out),options); }

      new OutputStreamWriter(out) gets operational system default charset
      at least it should be
      new OutputStreamWriter(out, "UTF-8") in this else-branch.
      finishCompressedOutputStream(out, options);
      if (options.getAutoClose()) out.close();
      }

      Attachments

        1. pretty_writer_default_charset.patch
          0.9 kB
          David Calavera

        Activity

          People

            Unassigned Unassigned
            zynevich Alexander Zynevich
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: