8000 Fix PlantUML image rendering failure with UTF-8 diagrams in Previm by mattn · Pull Request #229 · previm/previm · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@mattn
Copy link
Member
@mattn mattn commented Nov 16, 2025

Previm’s PlantUML encoder failed to generate valid URLs when diagrams contained non-ASCII (UTF-8) characters or comment lines starting with ' ---. The custom encode64 implementation produced incorrect PlantUML-encoded data, causing the PlantUML server to return 404 IMAGE NOT FOUND errors. Additionally, ' --- lines were sometimes misinterpreted as Markdown horizontal rules, resulting in truncated UML text.

This patch replaces the encoder with the official PlantUML encode.js implementation (encode6bit / append3bytes / encode64), ensuring correct UTF-8 handling and compliant URL generation. It also normalizes problematic ' --- comment lines to avoid Markdown tokenizer conflicts.

As a result, diagrams containing Japanese text and inline comments now render correctly in Previm.

Previm’s PlantUML encoder failed to generate valid URLs when diagrams
contained non-ASCII (UTF-8) characters or comment lines starting with
`' ---`. The custom encode64 implementation produced incorrect
PlantUML-encoded data, causing the PlantUML server to return 404
IMAGE NOT FOUND errors. Additionally, `' ---` lines were sometimes
misinterpreted as Markdown horizontal rules, resulting in truncated
UML text.

This patch replaces the encoder with the official PlantUML encode.js
implementation (encode6bit / append3bytes / encode64), ensuring correct
UTF-8 handling and compliant URL generation. It also normalizes
problematic `' ---` comment lines to avoid Markdown tokenizer conflicts.

As a result, diagrams containing Japanese text and inline comments now
render correctly in Previm.
@mattn mattn merged commit 981a4c1 into master Nov 20, 2025
6 checks passed
@mattn mattn deleted the fix-plantuml branch November 20, 2025 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0