Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-283

Character encoding/appearance issues when filling forms

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.0.0
    • 2.0.0
    • AcroForm
    • None

    Description

      [imported from SourceForge]
      http://sourceforge.net/tracker/index.php?group_id=78314&atid=552832&aid=1735902
      Originally submitted by scop on 2007-06-12 10:23.

      When filling a text field with non-ASCII characters such as in my surname "Skyttä" and saving the document in a UTF-8 environment, something goes wrong with the appearance of the text.

      The value itself seems to be stored correctly, but when opening the doc, the appearance of "ä" is not that, but rather something which happens when UTF-8 is mistakenly treated as ISO-8859-1 (two garbage characters).

      PDAppearance uses the platform default encoding in quite a few places which apparently has potential to mess things up. In particular, insertGeneratedAppearance() generates a PrintWriter from an OutputStream without specifying the encoding. In fact, if I hack that to use ISO-8859-1, the appearance of my "ä" case is correct, but that won't obviously work with anything else than chars that are valid ISO-8859-1.

      In which char encoding should the value be written to the appearance stream (at end of insertGeneratedAppearance())?

      Attachments

        1. PDAppearance.patch
          0.8 kB
          Maruan Sahyoun
        2. PDAppearance.diff
          2 kB
          Marco Primiceri
        3. PDAppearance_bis.diff
          2 kB
          Marco Primiceri
        4. acroform.pdf
          464 kB
          Marco Primiceri

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Anonymous Anonymous
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: