How to use Japanese Font in dot ?

0 votes
asked Dec 14, 2018 in Question / help by Tomo (120 points)
Japanese fonts are garbled with using dot function.

In case of using "dot.exe", OK.

command : dot -Tpng test_dot.txt > test_dot.png

* test_dot.txt

digraph aa {
 graph [charset="UTF-8"];
 n1 [label="テスト", fontname="MS GOTHIC"]
}

In case of using "plantuml.jar", NG.

command : java -jar plantuml.jar -charset UTF-8 test_dot_puml.txt

* test_dot.txt

@startdot
digraph aa {
 graph [charset="UTF-8"];
 n1 [label="テスト", fontname="MS GOTHIC"]
}
@enddot

Does anyone know how to solve the problem ?

1 Answer

0 votes
answered Dec 15, 2018 by albert (2,740 points)
edited Dec 16, 2018 by albert

I think the problem is the double usage of the UTF-8.

For me the following worked:

- pasting the plantuml code straight into the plantuml webbrowser (see http://www.plantuml.com/plantuml/png/SoWkIImgISaluKh9J2zABCXGI4nKgEPIWB2ZapCIYufJIsoLGaFST2sKOgsv5F8C5Q9p4fDISsoL7ZUtFMxQ-RYvGqb78Iq_hoGlCJVLLiatMC7TFyJ3qrafbgkMoo4rBmLeF000)

-same as above, even without the graph... line (see http://www.plantuml.com/plantuml/png/SoWkIImgISaluKh9J2zABCXGI4nKgEPIo3DKYCv9J4hDiLLwtDpsk6ddu-OE9Hs5jFoyahp4t5HR9TzW1NV_40zFPwLOhbekXzIy5A0X0000)

Note that I'm not on a Japanese type of computer / OS.

Running with the newest beta version (PlantUML version 1.2018.14beta12), I got the following results:

- code as specified in question

  - call with -charset UTF-8: resulted in question marks in picture

  - call without -charset UTF-8: resulted in a good picture (as far as I can judge)

- code without the graph [charset="UTF-8"]; line:

  - call with -charset UTF-8: resulted in question marks in picture

  - call without -charset UTF-8: resulted in a good picture (as far as I can judge)

commented Dec 17, 2018 by Tomo (120 points)
Thank you for the reply.

I have tried your advice.

(A)java -jar plantuml.jar -charset UTF-8 test_dot_puml_cmd_charset_with_graph.txt
(B)java -jar plantuml.jar -charset UTF-8 test_dot_puml_cmd_charset_without_graph.txt
(C)java -jar plantuml.jar test_dot_puml_with_graph.txt
(D)java -jar plantuml.jar test_dot_puml_without_graph.txt

Results of (A) and(B) are same. And results of (C) and (D) are same.
But all results are garbled.

If there are any method to share bat files and result images, I share them.

I'm using PlantUML version 1.2018.13 (Tue Nov 27 02:11:51 JST 2018).
Is it possible to cause the problem ?
If so, could you please tell me how to download 1.2018.14 ?

Thanks a lot.
commented Dec 19, 2018 by albert (2,740 points)
Bit late response, email notification landed in spam bucket :-( ).
I didn't use any bat file, just straight on commands on the code as specified in the question.
To see the results of the, open the plantuml webbrowser (http://www.plantuml.com/plantuml) and past into the bottom line the complete URL from my answer.

Problem might be due to the used language on the computer (I use Windows 7 in US-English language).
...