Fix SVG coordinate formatting broken on non-English JVM locales (Czech, German, etc.) #3
Open
tombarys wants to merge 1 commit intoscicloj:mainfrom
Open
Fix SVG coordinate formatting broken on non-English JVM locales (Czech, German, etc.) #3tombarys wants to merge 1 commit intoscicloj:mainfrom
tombarys wants to merge 1 commit intoscicloj:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hi, this is my third PR in my whole life, so I hope it will work. I found a small bug leading to something like this:
I cooperated with Claude and here is the solution.
plotje version: 0.2.0
Description:
Charts render nearly empty when the JVM runs under a locale that uses a comma as the decimal separator (e.g.
cs_CZ,de_DE).Root cause:
scicloj/plotje/render/svg.cljformats SVG coordinates using(format "%.2f" v), which is locale-sensitive. On Czech locale this produces"12,00"instead of"12.00", turning a validtranslate(12.00,181.00)into a malformedtranslate(12,00,181,00)with four arguments — breaking all point and axis placement.Minimal repro:
Workaround:
(java.util.Locale/setDefault java.util.Locale/ROOT)or add to deps.edn:
Suggested fix sent in this PR:
In
svg.clj, thefmthelper has to be changed to pin the locale explicitly:Best.