Search code examples
javadownloadoracle-adfweblogic11g

Change encoding of adf rich faces' fileDownloadActionListener


I am using fileDownloadActionListener as follows:

<af:fileDownloadActionListener contentType="text/plain; charset=ISO-8859-15"
     filename="#{row.FileName}.txt"
     method="#{backingBeanScope.backing_pages_general_files_download.downloadFile}"/>

The download works fine.

I have the application deployed on weblogic:

  1. Locally on Windows
  2. Remotely on Linux

When I download the file from Windows deployment and open by notepad it shows encoding ANSI When I download the file from Linux deployment and open by notepad it shows UTF-8

But I need the encoding of the dowmloaded file to be ISO-8859-15.

Any help would be appreciated.


Solution

  • I did it in the following way:

    1. I accessed the file_to_read_from with UTF-8 format
    2. I changed the contents to ISO-8859-15
    3. I fetched the bytes_to_write and converted to ISO-8859-15
    4. I put both to an byte array with ISO-8859-15 format
    5. Changed the jspx that contains the view to contents of ISO-8859-15