joshwlewis / unitwise

Physical quantity and units of measure conversion and math for Ruby
unitwise.org
MIT License
282 stars 32 forks source link

Microgram does not work with certain version of the symbol #63

Open Dan-Burnette opened 5 years ago

Dan-Burnette commented 5 years ago

There are two different possible UTF-8 encodings for the 'microgram symbol' that look identical:

"µ" which is encoded as 194 181 and defined as "micro sign"

and

"μ" which is encoded as 206 188 and defined as "greek small letter mu"

The one being utilized inside of unitwise is currently the "greek small letter mu".

Thus something like Unitwise.search("µ") with the "micro sign" returns an empty array.

I'm not sure if addressing this is really in the scope of this gem, as it simply pulling the data from UCUM. It would appear there is not yet precedent for having multiple symbols for a single prefix; perhaps there aren't any other units that run into this sort of thing, but this was a bit of a gotcha for me as I'm pulling API data containing the "micro sign" version.