DisplayTag
  1. DisplayTag
  2. DISPL-107

Excel and Text exports use Windows Latin-1 encoding

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0 RC2
    • Fix Version/s: 1.1
    • Component/s: Export
    • Labels:
      None
    • Application server:
      JBoss 3.2.5

      Description

      Data coming out of my UTF-8 format Postgres database appears correctly in displaytag tables on webpages, but when I request an export in Excel or text format, all non ASCII characters are garbled. I am using the Mac OS X Platform.

      After some exploration, I determined that this is due to the file encoding being set to Windows Latin-1. Excel documents which were created on Windows and that I open on my Mac do not have garbled non-ASCII text, so I suspect that all that is missing in the exported file is some way to indicate to Excel what encoding has been used. Some of my recent web searches suggest that at least the more recent versions of Office store characters in little-endian UCS2 encoding.

      For text files, it seems to me that UTF-8 would be the the most platform and language agnostic encoding to use.

        Activity

        Hide
        fabrizio giustina added a comment -
        sorry, postponing a fix since I'm still unable to reproduce the problem. Unit tests give a positive results and sniffing the content type on a live web application gives me correctly UTF8. :/
        I'll try to run some test on a similar environment, but at the moment I can't do anything to fix it.

        If you need a quick solution for the excel export you could use a customized export view using POI, which generates binary excel files.
        Show
        fabrizio giustina added a comment - sorry, postponing a fix since I'm still unable to reproduce the problem. Unit tests give a positive results and sniffing the content type on a live web application gives me correctly UTF8. :/ I'll try to run some test on a similar environment, but at the moment I can't do anything to fix it. If you need a quick solution for the excel export you could use a customized export view using POI, which generates binary excel files.
        Hide
        added a comment -
        ?
        Show
        added a comment - ?
        Hide
        Ray Tsang added a comment -
        I am experiencing the same issue. The exported file is indeed UTF8 encoded, but Excel does not open it correctly when opened directly (through the browser or by double clicking). If you start Excel first, then open the file through "Open File" operation, it would detect the encoding correctly. Moreover, if you resave the file from Excel as tab delimited file again, it would open correctly in the future.

        Turns out, when saving Tab-delimited file from Excel, it does not save w/ the surrounding quotes (").
        Show
        Ray Tsang added a comment - I am experiencing the same issue. The exported file is indeed UTF8 encoded, but Excel does not open it correctly when opened directly (through the browser or by double clicking). If you start Excel first, then open the file through "Open File" operation, it would detect the encoding correctly. Moreover, if you resave the file from Excel as tab delimited file again, it would open correctly in the future. Turns out, when saving Tab-delimited file from Excel, it does not save w/ the surrounding quotes (").
        Hide
        fabrizio giustina added a comment -
        since the problem is related to Excel handling of UTF8 encoded files, the fix here is to use the new binary excel format which will be included in displaytag 1.1.
        Tests for for the csv/xml format also show that encoding is preserved during export and I can't see any other possible fox to displaytag...
        Show
        fabrizio giustina added a comment - since the problem is related to Excel handling of UTF8 encoded files, the fix here is to use the new binary excel format which will be included in displaytag 1.1. Tests for for the csv/xml format also show that encoding is preserved during export and I can't see any other possible fox to displaytag...
        Hide
        Jan added a comment -
        Hello,
        this bug is closed but I'm also having that issue in 1.2 when exporting to csv file. The JSP page has a UTF-8 encoding and characters with accents are all displayed ok. When I export to csv, the response has a "Content-Type: text/csv;charset=ISO-8859-1
        ". The result file is then not displayed correctly on Linux.
        Show
        Jan added a comment - Hello, this bug is closed but I'm also having that issue in 1.2 when exporting to csv file. The JSP page has a UTF-8 encoding and characters with accents are all displayed ok. When I export to csv, the response has a "Content-Type: text/csv;charset=ISO-8859-1 ". The result file is then not displayed correctly on Linux.

          People

          • Reporter:
            J. Patterson Waltz III
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: