關於Activiti explorer 中 部署時中文亂碼問題
阿新 • • 發佈:2019-02-03
在用activiti 中bpmn檔案部署時 發生了影象和流程 以及 名稱的亂碼,
修改時先在啟動引數設定下中文支援(有部分原因是這個)
再者:
protected void deployModelerModel(final ObjectNode modelNode) { try { BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode); byte[] bpmnBytes = new BpmnXMLConverter().convertToXML(model); String processName = modelData.getName() + ".bpmn20.xml"; Deployment deployment = repositoryService.createDeployment() .name(modelData.getName()) .addString(processName, new String(bpmnBytes, "utf-8")) .deploy(); ExplorerApp.get().getViewManager().showDeploymentPage(deployment.getId()); }catch (Exception e){ LOGGER.error("中文亂碼", e); } }
注意這條
.addString(processName, new String(bpmnBytes, "utf-8"))
原始碼在activiti\modules\activiti-explorer\src\main\java\org\activiti\editor\ui\EditorProcessDefinitionDetailPanel.java