AnsweredAssumed Answered

Diagram utf-8 encode problem

Question asked by gqsforme on Jul 7, 2014
Latest reply on Jul 9, 2014 by kevinguo1989
Hello everybody !

I am use the  ProcessDiagramGenerator.generateDiagram API to generate deagram,but connot display Chinese

    ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) 
             ((RepositoryServiceImpl) activiti.getRepositoryService()).getDeployedProcessDefinition(instance
                  .getProcessDefinitionId());
       if (processDefinition != null && processDefinition.isGraphicalNotationDefined()) {
            InputStream in = ProcessDiagramGenerator.generateDiagram(activiti.getRepositoryService().getBpmnModel(instance.getProcessDefinitionId()), "png",
                  activiti.getRuntimeService().getActiveActivityIds(instance.getId()));
            try {
            OutputStream out = new FileOutputStream(new File("d:\\Diagram.png"));
            IOUtils.copy(in, out);
            in.close();
            out.flush();
            out.close();
         } catch (FileNotFoundException e) {
            e.printStackTrace();
         } catch (IOException e) {
            e.printStackTrace();
         }
       }

or using the following way and the Disagram.png are not open

   InputStreamReader reader = new InputStreamReader(in);
            OutputStream out = new FileOutputStream(new File("d:\\Diagram.png"));
            IOUtils.copy(reader, out,"utf-8");

Thanks!

Outcomes