How do you retrieve UTF-8 encoded PlantUML sources from PNG image ?

0 votes
asked Sep 8 in Question / help by mmatt

Hi, when I generate PNG with following command

java -jar plantuml.jar -charset UTF-8 utf8.puml

with diagram utf8.puml that contains:

@startuml

skinparam roundcorner 20
skinparam sequence {
  ArrowColor DodgerBlue
    ActorBorderColor Black
    LifeLineBorderColor DodgerBlue
  ParticipantBorderColor Black
}

actor "user" as user
participant "participant" as other

title some text
autonumber 1

user -> other : here is special text éàçùîêèûô

@enduml

I get PNG image utf8.png but when I try to retrieve sources from this image I get bad encoding :

java -jar plantuml.jar -charset UTF-8 -metadata utf8.png > utf8_extract.puml

as you can see below :

------------------------
utf8.png

@startuml

skinparam roundcorner 20
skinparam sequence {
  ArrowColor DodgerBlue
    ActorBorderColor Black
    LifeLineBorderColor DodgerBlue
  ParticipantBorderColor Black
}

actor "user" as user
participant "participant" as other

title some text
autonumber 1

user -> other : here is special text ���������

@enduml

PlantUML version 1.2021.9(Sun Jul 25 12:13:56 CEST 2021)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Default Encoding: Cp1252
Language: fr
Country: FR

------------------------

Is it possible to retrieve UTF-8 encoded file with only a one-line command instead of default Cp1252 ?

Thanks

1 Answer

0 votes
answered Sep 8 by The-Lu (31,200 points)
 
Best answer

Hello M.,

1/ From: 

java -jar plantuml.jar -charset UTF-8 -metadata utf8.png > utf8_extract.puml

2/ Could you test with:

java -Dfile.encoding=UTF-8 -jar plantuml.jar -metadata -charset UTF-8 utf8.png > utf8_extract.puml

See also this other thread:

If that can help,
Regards,
Th.

commented Sep 8 by mmatt
Hi Th.

Your suggestion was right and helped me a lot because it works fine with -Dfile.encoding=UTF-8

Sorry for not enough searching (wrong tags) in forum and asking another-already-resolved-in-previous-thread question :-/

Anyway, thanks a lot for your quick replay
and thanks to plantuml for this software absolutely briliant!
commented 2 days ago by Largo (140 points)
thanks for asking anyway, this tough me I could recover the UML script from my PNG, just saved me hours of work!!!
...