Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

PlantUML export fails when element names are Unicode characters #15

Closed
xuning97 opened this issue Jun 18, 2022 · 5 comments
Closed

PlantUML export fails when element names are Unicode characters #15

xuning97 opened this issue Jun 18, 2022 · 5 comments

Comments

@xuning97
Copy link

for user = person "用户1", export to plantuml, it becomes
person "==用户1\n<size:10>[Person]</size>" <<1>> as 1

@simonbrowndotje simonbrowndotje transferred this issue from structurizr/cli Jun 21, 2022
@simonbrowndotje
Copy link
Contributor

If it's the [Person] text that you're referring to, you can change this via the terminology keyword. For example:

workspace {

    model {
        user = person "用户1"
    }

    views {
        systemLandscape "MyDiagramKey" {
            include *
        }
        
        terminology {
            person "xxx"
        }
    }
    
}

Here's an example.

@cgi
Copy link

cgi commented Aug 10, 2022

I think point is that userId (alias) is rendered with error: see "as 1" fragment in result.

I get same issue with russian names ob objects.
As I could understand reasons - thats from https://github.com/structurizr/export/blob/main/src/main/java/com/structurizr/export/plantuml/AbstractPlantUMLExporter.java#L159
filter function - it's delete any non [a-zA-Z_0-9] characters.
But - it's not realy nessesary in PlantUML to make so strict rules for Ids: see https://plantuml.com/ru/unicode

My suggest for patch is: change regexp puttern to unicode aware: from "\W" to "(?U)\W".
see for explanation: https://stackoverflow.com/questions/4304928/unicode-equivalents-for-w-and-b-in-java-regular-expressions

@simonbrowndotje
Copy link
Contributor

Do you have an example DSL that doesn't work?

@cgi
Copy link

cgi commented Aug 17, 2022

Here is example:

workspace {

    model {
        user = person "Пользователь"
    }

    views {
        systemLandscape "MyDiagramKey" {
            include *
        }

        terminology {
            person "xxx"
        }
    }
}

command for export:
structurizr.bat export -workspace test\workspace.dsl -format plantuml -output .\export

result plantUML file:

@startuml
title System Landscape

top to bottom direction

skinparam {
  shadowing false
  arrowFontSize 10
  defaultTextAlignment center
  wrapWidth 200
  maxMessageSize 100
}

hide stereotype

skinparam rectangle<<>> {
  BackgroundColor #dddddd
  FontColor #000000
  BorderColor #9a9a9a
}

rectangle "==Пользователь\n<size:10>[Person]</size>" <<>> as 

@enduml

Take a note for empty alias and stereotype name in difinitions.

@simonbrowndotje simonbrowndotje changed the title chinese language support needed PlantUML export fails when element names are Unicode characters Aug 17, 2022
@simonbrowndotje
Copy link
Contributor

Thanks ... I think this is different from the original issue, so I've changed the title.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants