Building Svg with -pipe results in Replacing of SpecialCharacters with '?'

0 votes
asked Apr 15, 2019 in Question / help by Herrmel

I have a diagramm i want to generate local wich contain special characters like Ä,ü. When I load a textfile with the textcontent or build the text online on your website it works fine. But when I build it with a pipe the characters turn to '?'. For example I use the following powershellcommand:
Get-Content .\test.txt|java -jar plantuml.jar  -tsvg -pipe|Out-String

I tried a older and the newest version. -Charset didnt help. Couldnt find anything java related. I have to use the pipe because I integrated plantuml in a .net application. I tried a few hours to change every possible encoding of the process result and process input to Utf-8 and couldnt find a solution. Since in Powershell Get-Content .\test.txt prints a text with the special Characters i guess its java or plantuml but i have no clue.
Thank you for your great work^^

1 Answer

0 votes
answered Apr 15, 2019 by plantuml (294,960 points)

Maybe you should try  -Dfile.encoding=UTF-8

Tell us if it helps.

commented Apr 29, 2019 by Herrmel
Thanks for your quick reply. Sadly it did not work. In the outputcomment Default Encoding is mentioned as Utf-8 now instead of Cp1252 but the result stays the same.
Here is a short example plantuml code btw:
@startuml
note: Stellt angepasste Datenpunktadressierungen für Geräte oder Gerätefamilien Bereit.
@enduml
commented Mar 13, 2020 by Herrmel

hi I'm once again trying to fix this Problem. I just can't find the point where the encoding is messed up. When I use filepaths as parameterinput it works without any Problems. But once I use -pipe I get '?'-Characters for every specialsign. I tested this on 2 machines and it both has the same Problem. Both OS are Windows btw. You should be able to reproduce this easyly with Powershell:


"@startuml
start
:Händlebar;
stop
@enduml" | java -D"file.encoding"=UTF8 -jar YourPathTo\plantuml.jar -charset UTF-8 -pipe -tsvg


In the Output you should see in the comment:
 ...
:H?ndlebar;
...

Also your example from the documentation

cat somefile.puml | java -jar plantuml.jar -pipe > somefile.png

does not work for me on Windows. cat in powershell is a alias for Get-Content where you should add "-Encoding UTF8" so the text is correctly read. But even then I cant open the resulting png with any tool successfully. Maybe this Problem is Windows specific? Thanks for your support.

commented Mar 13, 2020 by Herrmel

Nevermind I finally fixed it. Powershell has a Variable $OutputEncoding and you need to set this to utf8 first and then also use -D"file.encoding=UTF8"...This took me way too long cool

...