plantuml / plantuml-server

PlantUML Online Server
https://plantuml.com/
GNU General Public License v3.0
1.6k stars 462 forks source link

Error when rendering code containing Chinese characters into a PDF #283

Open HansBug opened 1 year ago

HansBug commented 1 year ago

As mentioned above, the latest version of the PlantUML server (version 23731c11bcf6, or jetty-v1.2023.6) fails to display Chinese characters correctly when rendering UML code containing Chinese characters into PDF format.

Here is an example code

@startuml
用户 -> 认证中心: 登录操作
认证中心 -> 缓存: 存放(key=token+ip,value=token)token

用户 <- 认证中心 : 认证成功返回token
用户 -> 认证中心: 下次访问头部携带token认证
认证中心 <- 缓存: key=token+ip获取token
其他服务 <- 认证中心: 存在且校验成功则跳转到用户请求的其他服务
其他服务 -> 用户: 信息
@enduml

It should be rendered like this (as it in PNG, SVG or even ASCII art format):

image

But it is actually rendered like this in pdf:

image

PS: I have just tested and encountered the same issue with the tomcat version image as well.

HeinrichAD commented 1 year ago

I tried your example directly with the lastest release (v1.2023.6) from plantuml (without the server part) as descript here and got the same result. Hence, I'm confident, that this isn't a plantuml-server but a plantuml bug. Maybe it is more promising to open/share the issue there?

HansBug commented 1 year ago

@HeinrichAD Fine, I opened an issue there https://github.com/plantuml/plantuml/issues/1426

I am maintaining a Python-based Plantuml SDK and CLI library called plantumlcli. Currently, this issue can be temporarily bypassed by installing cairosvg (which obtains a normal SVG image and converts it to PDF).

HeinrichAD commented 1 year ago

I tried to look a little bit into the problem and created a test repository: https://github.com/HeinrichAD/java-svg2pdf-issue

I have tried a few approaches, but unfortunately have not found a (quick/simple) solution.