I have some numbers coming in as strings using non-ASCII digits unfortunately. I need to convert them to regular Ruby numbers to do some math on them. So for example if the number-as-a-string "۱۹" comes in, which is 19 but as the characters "extended arabic indic digit one" followed by "extended arabic indic digit nine", I need a way to convert that to the Ruby integer Fixnum 19.

The problem is, according to this, there are 55 groups of 0-9 of these extended digits, i.e. 550 total codepoints I need to handle.

I already know that for a given group, the codepoints for consecutive digits are contiguous, so for example extended arabic indic digit 0 is U+06F0 and extended arabic indic digit 9 is U+06F9, so I can test each digit to see which range it's in and then subtract the zero codepoint as an integer from the codepoint of the character I'm looking at, to give me the regular Ruby integer. For example, 6F9 - 6F0 = 9 (in rough terms, once they're converted to their integer code points).

But to do this, I need to create a giant lookup hash for these 55 ranges and that's a lot of typing. I suppose I could translate the HTML table at the link above into a ruby map, but that feels hacky.

I already know that

```
"۱۹" =~ /[[:digit:]]+/
```

will be a match, but the question is "How to turn those Unicode digits back into regular Ruby integers?"

There has to be a better way! Any ideas?

Thanks!