Cannot use utf-8 encoded image file name to configure node form

I saved the utf-8 encoded DOT code file. But it cannot output a png image file with a custom form. Is there an example to demonstrate custom use of a character set in graphics?

Demo code is here.

digraph G { bgcolor=black; edge [arrowsize=1, color=red]; node [penwidth=1, color=white, labelloc=b]; BR [shape=box, label="BR", charset="utf-8", image="ε›Ύε…ƒ.png"]; DS [shape=plaintext, fontname="SimSun", fontcolor=white, fontsize=18, label="ζ΅‹η‚Ή"]; BR -> DS[dir=forward]; } 

And the command line results are listed below.

 C:\dot>dot -Gcharset=utf-8 -Tpng -o demo.png demo.dot Warning: No such file or directory while opening ι₯ζƒ§εŽ“.png Warning: No or improper image="ι₯ζƒ§εŽ“.png" for node "BR" 
+4
source share
1 answer

There is an encoding problem in the chain. The name of the image file in the source is ε›Ύε…ƒ.png , but when graphviz reads it, it sees ι₯ζƒ§εŽ“.png .

This means that you did not save the file as UTF-8 or that the default encoding of your OS is not UTF-8. I could not find a way to tell the source encoding graphic in the documentation. The charset option is used only when interpreting string input as a text label. "(see also Character Encodings ")

So this will not solve your problem. One solution is to replace Unicode characters with an HTML object. So you can use "圖元.png" , but again, the documentation says: "During the evaluation of the tag, these objects are translated," which probably means they are no longer translated.

0
source

Source: https://habr.com/ru/post/1384849/


All Articles