Skip to main content



      Home
Home » Archived » BIRT » Unable to set character encoding for URL parameters for report
Unable to set character encoding for URL parameters for report [message #250659] Tue, 31 July 2007 22:29 Go to next message
Eclipse UserFriend
Hi,
I am trying to pass some chinese text to BIRT as a parameter on the URL
for example:

http://localhost:9080/myapp/run?__report=myrep.rptdesign& ;subscriber=%E7%94%A8%E6%88%B7%E5%90%8D.

and I want to read the subscriber name inside the initialize event handler
of the report design using:
importPackage(Packages.javax.servlet.http);
var subscriber =
reportContext.getHttpServletRequest().getParameter("subscriber ");

However, after these calls, the subscriber name is not set correctly to the
Chinese text. I think this is becuase the character encoding of the request
object needs to be set to "UTF-8". However if I add the following line

request.setCharacterEncoding("UTF-8");

between the two lines above the text is still not correct. I noticed that
the description of the setCharacterEncoding() method says it cannot be
called after any parameters have been retrieved from the request object. I
assume BIRT has retrieved the report name from the request object before the
initialize event handler is called so, therefore, my setCharacterEncoding()
call is ignored and consequently the subscriber name is set incorrectly.

I was able to work arouud the problem by creating my own servlet which
sets the character encoding of the request object and then forwards the
request to BIRT's run servlet using:

request.setCharacterEncoding("UTF-8");
request.getRequestDispatcher("/run").forward(request, response);

Is there a way to solve the problem without having to introduce my own
servlet?

Thanks
Craig.
Re: Unable to set character encoding for URL parameters for report [message #1828769 is a reply to message #250659] Thu, 18 June 2020 06:41 Go to previous message
Eclipse UserFriend
Hi Craig.
I faced the same problem. your workaround worked for me.
Thank you.
Previous Topic: How birt handles Khmer text
Next Topic:pdf custom font formating problem
Goto Forum:
  


Current Time: Fri Jul 04 23:11:59 EDT 2025

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

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

Back to the top