Closed hi-i-m-GTooth closed 11 months ago
Same problem on my project! Any solution??
Why don't you use utf-8 as input file encode?
Why don't you use utf-8 as input file encode?
Hi, @KSR-Yasuda! Thanks for your reply!
Actually, I did check my input encoding type. It'll be utf-8
if I type file -bi test_gantt.md
:
text/plain; charset=utf-8
And I'll call mmdc
via bash in Python like this (I also printed those input strings and they're normally encoded):
subprocess.run(f"{os.path.join('node_modules', '.bin', 'mmdc')} -i - -o "+filename, shell=True, input=text, encoding="utf-8")
By the way, here is an interesting point I found: I can successfully draw a chart with chinese in Windows but not Linux OS.
@hi-i-m-GTooth
By the way, here is an interesting point I found: I can successfully draw a chart with chinese in Windows but not Linux OS.
Is that so?
In my env, Ubuntu 18.04.6 LTS, it worked successfully...
(checked passing the mmd text directly to mmdc
command).
@hi-i-m-GTooth
By the way, here is an interesting point I found: I can successfully draw a chart with chinese in Windows but not Linux OS.
Is that so? In my env, Ubuntu 18.04.6 LTS, it worked successfully... (checked passing the mmd text directly to
mmdc
command).
Hi @KSR-Yasuda ! Sorry for the late reply! I also tried to directly used mmdc
to ensure that the problem comes from mermaid. The problem still exists ... ( My Ubuntu is built on Azure's VM. But I think this is not the main reason since my Windows is also built on Azure's VM. )
@hi-i-m-GTooth, my gut feeling is that the version of Ubuntu you're using with Azure's VM doesn't have any CJK fonts installed.
Can you try running installing fonts-noto-cjk-extra
with sudo apt install fonts-noto-cjk-extra
?
My Ubuntu is built on Azure's VM. But I think this is not the main reason since my Windows is also built on Azure's VM.
Generally, Ubuntu's minimal cloud images can be very very small, e.g. only 104MiB, see https://cloud-images.ubuntu.com/minimal/releases/jammy/release-20230828/
Installing fonts-noto-cjk-extra
and fonts-noto-cjk
uses up 312 MiB of disk space, so it's like a 300% increase in disk space and for most applications, a server install of Ubuntu doesn't need any fonts :)
Side-note, you can also use the mermaid-cli
Docker image if you're willing to use Alpine Linux instead of Ubuntu, as it already has the fonts-noto-cjk
installed for you, see https://github.com/mermaid-js/mermaid-cli/blob/6a6c160277bf4798a794c3e25bbde8d736feafed/install-dependencies.sh#L5
Hi @aloisklink ! Thanks for giving me this advice! It works! I didn't know I need this font for chinese mermaid chart.
@hi-i-m-GTooth, my gut feeling is that the version of Ubuntu you're using with Azure's VM doesn't have any CJK fonts installed.
Can you try running installing
fonts-noto-cjk-extra
withsudo apt install fonts-noto-cjk-extra
?My Ubuntu is built on Azure's VM. But I think this is not the main reason since my Windows is also built on Azure's VM.
Generally, Ubuntu's minimal cloud images can be very very small, e.g. only 104MiB, see https://cloud-images.ubuntu.com/minimal/releases/jammy/release-20230828/
Installing
fonts-noto-cjk-extra
andfonts-noto-cjk
uses up 312 MiB of disk space, so it's like a 300% increase in disk space and for most applications, a server install of Ubuntu doesn't need any fonts :)Side-note, you can also use the
mermaid-cli
Docker image if you're willing to use Alpine Linux instead of Ubuntu, as it already has thefonts-noto-cjk
installed for you, see
solved my problem!
Problem desciption
Hi, all. I just installed mermaid with
npm
locally, which means I will execute mermaid via./node_module/.bin/mmdc
. I would like to draw a mindmap with some chinese text. However, the result seems weird(I also got same result when drawing gantt chart.).Input
Here is my input (I save it as
test.md
):Command
Here is the command I executed:
Result of chart
Following chart is the result. You could notice that there is no text on it instead of some squares.![image](https://github.com/mermaid-js/mermaid-cli/assets/31925572/969f9b75-44d7-4d69-9a4f-80b7f5c363c5)
Environment
Ubuntu 22.04.3 LTS
.npm
locally.node.js == v18.17.1
.Did I do anything wrong with the command? Or Mermaid installed with some dependencies related to OS's language? Thanks for your reading!
Best, Yu-Ze