on 01-11-2008 2:23 PM
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
Hi,
I found some more details on my problem:
The encoding of the output is not recognized correctly.
I tried to stream the output to HTML (instead of XLS). The rendering in the browser is also not correct, because the charset is not detected correctly. After selecting View > Encoding > UTF-8 the browser displays ok.
Next thought: In a standard Java servlet it would be possible to specify:
response.setContentType("text/html; charset=utf-8");
I guess it is needed to set the content charset of the Web Dynpro output in a similar way.
But I don't know how to do it...
Regards
Ingo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Remove this line
IWDResourceFactory.createInputStream(stringContent.getBytes("UTF-8"));
and try.. working for me for French.
Rahul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahul,
thank you for your reply.
I tried all three createInputStream lines separately. So I removed the charset parameter but of course I can't remove the whole line.
What do you mean by working in French? Other special characters like é and á are also not displayed properly.
Best regards
Ingo
User | Count |
---|---|
79 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.