Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Chinese characters in the runtime engine ?(How to set UTF-8 encoding for the runtime engine)
Chinese characters in the runtime engine ? [message #487242] Tue, 22 September 2009 15:05 Go to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: September 2009
Junior Member
Hi all,

My question is simple. I'm creating a simple report including a table whose column title are in Chinese. When I'm viewing the report in Eclipse, no problem, the Chinese character are correctly displayed.
But when I'm trying to see the same report by using the runtime engine deployed on my application server, the Chinese character are not properly displayed. The report is simply an HTML rendered report (even not a PDF).
I guess the problem comes from the fact that the runtime engine does not use UTF-8 when reading the XML report design file. Is there anyone who knows where I can set the proper character encoding for the runtime engine ? This should be a basic function but I can't find this info anywhere (I've already spend hours trying to figure out how to solve this simple problem... but nothing... And my report is unreadable!).
Any help or advice would be really appreciated..

Thanks in advance!

Arnaud.
Re: Chinese characters in the runtime engine ? [message #487273 is a reply to message #487242] Tue, 22 September 2009 15:51 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Arnaud,

Are you using the Viewer or did you write your own code?
If you can test with the deployed viewer. If you are using the RE API
try setting the locale on the task.

Jason

arnaudlevel@hotmail.com wrote:
> Hi all,
>
> My question is simple. I'm creating a simple report including a table
> whose column title are in Chinese. When I'm viewing the report in
> Eclipse, no problem, the Chinese character are correctly displayed.
> But when I'm trying to see the same report by using the runtime engine
> deployed on my application server, the Chinese character are not
> properly displayed. The report is simply an HTML rendered report (even
> not a PDF).
> I guess the problem comes from the fact that the runtime engine does not
> use UTF-8 when reading the XML report design file. Is there anyone who
> knows where I can set the proper character encoding for the runtime
> engine ? This should be a basic function but I can't find this info
> anywhere (I've already spend hours trying to figure out how to solve
> this simple problem... but nothing... And my report is unreadable!).
> Any help or advice would be really appreciated..
>
> Thanks in advance!
>
> Arnaud.
Re: Chinese characters in the runtime engine ? [message #487391 is a reply to message #487273] Wed, 23 September 2009 03:41 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: September 2009
Junior Member
Hi Jason,

Thanks for the quick reply!
I just wrote a Servlet that uses the Viewer. I tried setting the following local:
task.setLocale(Locale.TRADITIONAL_CHINESE);
I also set the utf-8 encoding in HTMLRenderOption:
options.setUrlEncoding("utf-8");

But it still does not work. Actually I'm not surprised since setting the locale is usefull when doing Internationalization. (The system uses the locale to find the right language property files). I'm not doing any Internationalization here, I have only one language which is Traditionle Chinese.
I don't know what encoding is used by the engine when reading xml design file and rendering the report. By using utf-8 it should work but I can't find where in the API I can set any encoding for that... And the thing is that when viewing the report in Eclipse, there is no problem which means the viewer and/or engine are using the right encoding inside Eclipse.
I'm really stuck now... And if nobody can give me a hint I only have the option to dig into the source to find out... But there must be some others users (in Asia at least) trying to do the same thing...?

Arnaud
Re: Chinese characters in the runtime engine ? [message #487393 is a reply to message #487391] Wed, 23 September 2009 04:04 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: September 2009
Junior Member
I've just tried the same report with the WebViewerExample provided with the runtime engine and it works fine...

On my application server I wrote a servlet that basically do the same thing as the ViewerServlet. I guess I missed something since there is no encoding problem when using the provided WebViewerExample. I'm going to look into the code again but if any idea is welcome...

Thanks!!!

Arnaud.
Re: Chinese characters in the runtime engine ? [message #487394 is a reply to message #487393] Wed, 23 September 2009 04:24 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: September 2009
Junior Member
Me again! I found my mistake... In the servlet I wrote I had not set the response encoding to utf-8. Doing this:
response.setContentType( "text/html;charset=utf-8" );
Before passing the response object to the Birt engine solved the problem.
Thanks Jason for your advice!

Arnaud.
Re: Chinese characters in the runtime engine ? [message #487543 is a reply to message #487394] Wed, 23 September 2009 14:50 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Arnaud,

Good to hear(Read:>)

Jason

arnaudlevel@hotmail.com wrote:
> Me again! I found my mistake... In the servlet I wrote I had not set the
> response encoding to utf-8. Doing this:
> response.setContentType( "text/html;charset=utf-8" );
> Before passing the response object to the Birt engine solved the problem.
> Thanks Jason for your advice!
>
> Arnaud.
>
Re: Chinese characters in the runtime engine ? [message #541674 is a reply to message #487543] Tue, 22 June 2010 06:44 Go to previous messageGo to next message
guna is currently offline gunaFriend
Messages: 1
Registered: June 2010
Junior Member
Arnaud,

i am also facing same problem.

i try to set the response object but i could not.
i am using struts 2.
i am passing servletContext object to create reportengine.

any one knows how to pass response object to birt as per the arnaud told. please reply.

Re: Chinese characters in the runtime engine ? [message #541814 is a reply to message #541674] Tue, 22 June 2010 15:25 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Are you using the code from:
http://birtworld.blogspot.com/2010/02/birt-and-struts-2.html
Make sure you have:
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
At the top of the html page.

Jason

On 6/22/2010 2:44 AM, guna wrote:
> Arnaud,
>
> i am also facing same problem.
>
> i try to set the response object but i could not.
> i am using struts 2. i am passing servletContext object to create
> reportengine.
>
> any one knows how to pass response object to birt as per the arnaud
> told. please reply.
>
>
Previous Topic:PDF output with garbled fonts
Next Topic:How to set date format programmatically
Goto Forum:
  


Current Time: Fri Apr 19 19:10:31 GMT 2024

Powered by FUDForum. Page generated in 0.04008 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top