Skip to Content
0
Former Member
Jan 11, 2008 at 02:23 PM

Problem with charset in Excel download file

270 Views

Hi,

in my WD application I have got a FileDownload UI-Element. An IWDResource from the context and an IWDInputStream are used to define the file and provide the data for the download. This is done just like described in the article "Exporting table data using On-Demand Streams."

Problem: Downloaded Excel or HTML files show wrong special characters e.g. German "Umlaute". This looks quite like a charset problem.

The content for the file comes from a String (let's say created using a StringBuffer or a StringWriter). It contains TAB separated values for the Excel.

I tried to build the IWDInputStream like this:

IWDResourceFactory.createInputStream(stringContent);

IWDResourceFactory.createInputStream(stringContent.getBytes("UTF-8"));

IWDResourceFactory.createInputStream(stringContent.getBytes("iso-8859-1"));

The Excel file looks different but not correct in all cases. e.g. instead of 'ü' there is 'u?'.'

What I also did to get more information:

I used a simple J2EE servlet to write the same content to a client.

There it is possible to set the charset: HTTPServletResponse::setContentType("application/vmd.ms-ecxel; charset=utf-8")

This looks ok in Excel.

Anybody got a hint? Do I have to explicitly set the charset somewhere?

Best regards

Ingo