Unable to set character encoding for URL parameters for report [message #250659] |
Tue, 31 July 2007 22:29  |
Eclipse User |
|
|
|
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.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03391 seconds