Skip to content

use unicode superscript instead of Square M Squared and Square M Cubed#437

Merged
keilw merged 1 commit into
unitsofmeasurement:masterfrom
david-nominal:patch-1
Mar 29, 2025
Merged

use unicode superscript instead of Square M Squared and Square M Cubed#437
keilw merged 1 commit into
unitsofmeasurement:masterfrom
david-nominal:patch-1

Conversation

@david-nominal

@david-nominal david-nominal commented Mar 19, 2025

Copy link
Copy Markdown
Contributor

u33A1 looks like this:
m\u00B2 looks like this:

per wikipedia the latter is preffered: https://en.wikipedia.org/wiki/Square_metre

Same for cubic: vs


This change is Reviewable

@david-nominal

Copy link
Copy Markdown
Contributor Author

@keilw

@david-nominal david-nominal changed the title use unicode superscript use unicode superscript instead of Square M Squared and Square M Cubed Mar 19, 2025
@keilw keilw self-requested a review March 20, 2025 19:59

@keilw keilw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, what about the properties for EBNFUnitFormat?

@david-nominal

Copy link
Copy Markdown
Contributor Author

Can you elaborate on that? I just saw 90047a9#diff-850d9dffad4c5bb7538f9dbddccb0e8d613be4e041922c987b6ae5c94120da1cR458 and 467a85e#diff-850d9dffad4c5bb7538f9dbddccb0e8d613be4e041922c987b6ae5c94120da1cL444-R461, which added the "incorrect" square meter and am trying to fix it here. They don't seem to change any EBNFUnitFormat properties either?

@keilw

keilw commented Mar 28, 2025

Copy link
Copy Markdown
Member

EBNFUnitFormat.label() and alias() were added, see #429, mostly to add flexibility to other unit systems like SI, Unicode, etc., because it's not possible to add properties in the same package as this module under the Java Module system. So where called they override the defaults from the properties, but it would be best to change both places to the Unicode symbol, if you can.

And could you please add the old style \u33A1 and "\u33A5" as an alias, so parsing works both ways while formatting uses the nicer character. So change labelWithPrefixes(Units.CUBIC_METRE, "\u33A5"); to aliasWithPrefixes(Units.CUBIC_METRE, "\u33A5");

@keilw keilw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'll apply it like that and add what else is necessary. Thanks for the PR

@keilw keilw merged commit 0209eee into unitsofmeasurement:master Mar 29, 2025
@david-nominal

Copy link
Copy Markdown
Contributor Author

Sorry for the late reply @keilw , I was a bit busy with other stuff. Thanks for the merge and follow up!

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.

2 participants