JasperFill manager mangling parameters

We have a simple report that uses an Empty dataset to print certificates with the User's name and the course that they have passed.

The calling program extracts the data from the database and passes it as parameters to the report.

Seems simple.

The accented characters that are passed in are printed as 2 characters that look like they were passed in as UTF-8 and interpreted as something else.

The certificate prints the accented characters that are hardcoded in the report correctly so it is not the PDF step that is causing the problem. The rest of the portal application happily deals with French and  English all the time.


What character set is Jasper Reports expecting in parameters that are passed in to JasperFillManager?

If you look at the attached certificate, the person's name is supposed to be Michaël

The following is the code.

public void printCertificate(String user_full_name, String course_title,
                String request_lang, String certification_date, MessageContext ctx)  {

//This debug prints out the user name and course title correctly

        _log.debug("ws controller trying to print certificate with "+user_full_name+", "+
                course_title +", "+
                request_lang +", "+
        PrintCertificateResponse _response = new PrintCertificateResponse();
        HashMap<String, String> jasperParameter = new HashMap<String, String>();
        HttpServletRequest request = (HttpServletRequest) ctx.get(AbstractHTTPDestination.HTTP_REQUEST);
        String hostProtocol = request.getScheme();
        String reportTemplateName;
        jasperParameter.put("user_full_name", user_full_name);
        jasperParameter.put("course_title", course_title);
        jasperParameter.put("date", certification_date);
        String templateLocation = request.getSession().getServletContext().getRealPath("/WEB-INF/templates/"+reportTemplateName).toString();
        JasperReport jasperReport;
        try {
            JRDataSource datasource = new JREmptyDataSource();
            jasperReport = JasperCompileManager.compileReport(templateLocation);
            JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,jasperParameter, datasource);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();

            JasperExportManager.exportReportToPdfStream(jasperPrint, baos);

            _log.debug("outputstream size="+baos.size());
            HttpServletResponse response = (HttpServletResponse) ctx.get(AbstractHTTPDestination.HTTP_RESPONSE);

            _response.setServiceSuccess("service success");
            ServletOutputStream out1 = response.getOutputStream();
        } catch (JRException e) {
            //_response.setServiceSuccess("service failed "+e.getMessage());
        } catch (IOException e) {

ronatartifact's picture
Joined: Aug 30 2009 - 7:14pm
Last seen: 3 years 3 months ago

0 Answers:

No answers yet