gentooboontoo / js-quantities

JavaScript library for quantity calculation and unit conversion
http://gentooboontoo.github.io/js-quantities/
MIT License
396 stars 102 forks source link

added µ prefix #24

Closed bombledmonk closed 9 years ago

bombledmonk commented 9 years ago

This one line change is fairly self explanatory.

gentooboontoo commented 9 years ago

According to wikipedia, it seems legit because 'µ' is the official abbreviation and 'u' is considered as fallback one.

In circumstances in which only the Latin alphabet is available, the prefix can (unofficially) be represented using the letter u as in um for µm, or uF for µF.

To make sure the right unicode character is used, it would be preferable to explicitely use in the code its unicode escape sequence '\u00B5' instead of 'µ' literal and to add a test.

rage-shadowman commented 9 years ago

Yes, the official abbreviation is micro, not u... My question was more with how javascript and/or web browsers handle non-ascii characters. I simply don't know if this will work well in all cases or if there will be compatibility issues with different browsers or different charsets (locales).

rage-shadowman commented 9 years ago

For instance, the omega symbol is the correct character to use for ohm but does it work well with javascript? If so, then why doesn't js-quantities also use that? ...and the degree symbol before F for degF, etc...

gentooboontoo commented 9 years ago

Non-ASCII characters are not a problem because they are internally handled as Unicode by JavaScript whatever the locale is. Symbol support could be added to the library, they are not mandatory and will not introduce regressions, just additional ways to express units for those interested.

rage-shadowman commented 9 years ago

Good to know. I have looked in the past and could not find any authoritative documentation on the subject at the time.