Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wishlist: special character support #14

Open
Klortho opened this issue Apr 20, 2012 · 6 comments
Open

Wishlist: special character support #14

Klortho opened this issue Apr 20, 2012 · 6 comments

Comments

@Klortho
Copy link
Owner

Klortho commented Apr 20, 2012

Here's an idea I had back in the day, but I'm not sure how useful it would be, really. We could add support for these units:

Symbol Ord Name Meaning
µ B5 Micro Sign prefix for micro
¢ A2 Cent Sign 0.01 us-dollar
¹ B9 Superscript One Raise the preceding term to the 1st power (the identity operator)
² B2 Superscript Two squared
³ B3 Superscript Three cubed
× D7 Multiplication Sign multiplication operator
÷ F7 Division Sign division operator
¼ BC Vulgar Fraction One Quarter number 0.25
½ BD Vulgar Fraction One Half number 0.5
¾ BE Vulgar Fraction Three Quarters number 0.75
Others?
@jberger
Copy link
Collaborator

jberger commented Apr 20, 2012

Other than the mu symbol, and perhaps the angstrom sign, I'm not sure the others make much difference. That said, adding unicode might be a worthy goal. Users might want to add units with unicode, perhaps we eventually support currency exchange rates, that would need some unicode. Worthy goal.

@benkasminbullock
Copy link
Contributor

Since most physicists use LaTeX I would have thought being able to use LaTeX-style commands or output as LaTeX would be more useful than getting tangled up in Perl's Unicode stuff.

@Klortho
Copy link
Owner Author

Klortho commented Apr 23, 2012

Something like this unilatex.vim might come in handy.

@Klortho
Copy link
Owner Author

Klortho commented Apr 23, 2012

That said, I'd want to shy away from trying to implement too many mathematical operators. I'll admit a lot of the symbols above are kind of whimsical -- who would need the ¾ character to be properly implemented, after all?

I felt that implementing operators like "square" and "cubed" was a good idea, because they appear so often in the names of units, and maybe the superscript 2 and 3 could be implemented for that reason. But to try to implement real latex math expressions would be out of scope -- where would it end?

@jberger
Copy link
Collaborator

jberger commented Apr 23, 2012

BTW check out: https://github.com/jberger/Text-AsciiTeX also https://metacpan.org/module/Text::AsciiTeX

I personally don't think that playing with cutesy characters are in the best interest. I do think that making sure that the module can handle user-defined units with unicode work correctly is.

@benkasminbullock
Copy link
Contributor

Klortho says:

who would need the ¾ character to be properly implemented, after all?

Characters like ¾ are only in Unicode because Unicode had to encompass all of the crufty junk from old encodings like the Japanese and Chinese encodings from the 1980s, when people added this kind of character because all characters had to be in bitmapped graphics, or because some 1970s computer used these symbols in its bitmapped character set. They're not there because they were actually thought desirable as part of a modern standard. They are just in Unicode because Unicode had to be able to "round trip" from old standards and back again. It's better not to use any of these things except legitimate symbols like µ.

jberger says:

I do think that making sure that the module can handle user-defined units with unicode work correctly is.

The less the module does in terms of Unicode, the more likely it is that everything will "just work". If the module doesn't care about whether input strings are Unicode or not (is_utf8 or not), then Perl will probably take care of everything correctly. If the module starts insisting that input strings have to be one way or another, that is when things will break. As it is, if we don't do anything, the module probably will handle µ etc. correctly.

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

No branches or pull requests

3 participants