Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4418

specify charset for filedownload

    XMLWordPrintable

    Details

    • gh.sprint.customfield.default.name:
      ZK 9.5.1 S1

      Description

      Steps to Reproduce

      trigger a download with a specific charset

           byte[] data = "Price 500,00 €".getBytes("ISO-8859-15");
           Filedownload.save(data, "text/plain;charset=ISO-8859-15", "mytext.txt");
      

      or a binary download without a character encoding

           Filedownload.save("mysheet.xls", "application/vnd.ms-excel");
      

      Current Result

      the response header appends ;charset=utf-8 unnecessarily for binary files or overrides the provided values

      Content-Type: text/plain;charset=utf-8
      
      Content-Type: application/vnd.ms-excel;charset=utf-8
      

      Expected Result

      Content-Type: text/plain;charset=ISO-8859-15
      
      Content-Type: application/vnd.ms-excel
      

      Debug Information

      for each response the character encoding is set to utf-8

      https://github.com/zkoss/zk/blob/v9.0.0-RC2/zk/src/org/zkoss/zk/au/http/DHtmlUpdateServlet.java#L453

        Attachments

          Activity

            People

            Assignee:
            rudyhuang rudyhuang
            Reporter:
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 4 hours Original Estimate - 4 hours
                4h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 5 hours
                1d 5h