2

I cannot make plantuml set the UTF-8 charset, I've set

'(org-plantuml-executable-args '("-headless -charset UTF-8"))

in the init.el, but when I check in the message buffer the command invoked, these options are missing

java -jar /path/to/plantuml.jar -tsvg -p < /path/to/org-babel-temp-file > /path/to/file.svg

Any clue?

Thanks in advance.

1 Answer 1

3

Do C-h v org-plantuml-exec-mode to see its doc string:

org-plantuml-exec-mode is a variable defined in ‘ob-plantuml.el’.

Its value is ‘jar’

Method to use for PlantUML diagram generation. ‘jar’ means to use java together with the JAR. The JAR can be configured via ‘org-plantuml-jar-path’.

‘plantuml’ means to use the PlantUML executable. The executable can be configured via ‘org-plantuml-executable-path’. You can also configure extra arguments via ‘org-plantuml-executable-args’.

It is probably set to jar, the default, but org-plantuml-executable-args only applies when it is set to plantuml, i.e. when using the plantuml executable.

I looked around a bit to find a plantuml executable which must have existed at some point, but AFAICT no longer does. And the jar method in ob-plantuml.el does not allow for arguments (this is probably an omission that is worth a bug report).

SUGGESTION: I think the easiest thing to do is create your own plantuml executable as a shell script and change org-plantuml-exec-mode to plantuml. Something like this (but note it's very lightly tested):

#! /bin/bash

java -jar /path/to/plantuml.jar "${@}"

Put it into some directory, make it executable and then add something like this to your init file:

(setq org-plantuml-exec-mode 'plantuml)
(setq org-plantuml-executable-path "/path/to/script/above/plantuml")
(setq org-plantuml-executable-args '("-headless" "-charset UTF-8"))

Very lightly tested.

4
  • Indeed it's set to jar, but there's no option to pass arguments in java mode. If so, how can I solve it?
    – Daniele
    Nov 5, 2021 at 14:11
  • Added a suggestion to the answer.
    – NickD
    Nov 5, 2021 at 15:01
  • I'll try to open an issue on its mailing list.
    – Daniele
    Nov 9, 2021 at 21:27
  • You should try my suggestion: it should work as described.
    – NickD
    Nov 9, 2021 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.