Fix PlantUML image rendering failure with UTF-8 diagrams in Previm #229
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.