Add support for non english numbers in BitNumberField component
Is there an existing issue for this?
- [X] I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
The BitNumberField won't accept Persian numbers as valid digits.
More context on the problem:
There are several Language Packs available for Persian.
Let's say I have not passed in any format to the Format parameter. Hence, the underlying input element has a type=numeric attribute (based on your current implemnetation).
Now whether the input works as expected depends on the current language selected (Look at the image below too):
- English (last item in picture) <-- works
- Persian (First item in picture) <-- works
- Persian (Iranian Standard Persian keyboard) <-- doesn't work
- Persian (Persian (Standard) Keyboard) <-- doesn't work
The problem occurs only if I use the top row keys of keyboard for entering numbers (not the numeric pad on the right-side of physical keyboards)
Describe the solution you'd like
I have the idea of mapping the literal strings like ("۱", "۲", "۳", ...) to their equivalent English characters.
I can see that this idea is not aligned with the fact that your implementation so far is not bound to any specific culture and this solution won't scale to a generic solution suitable for all cultures.
Given all the nice multi-lingual capabilities, I hope finding some more robust solution.
Additional context
Though suggested by numerous resources that setting lang attribute will help the problem, I tested and can verify that it won't help the described problem.
@ShahryarSaljoughi Thanks for contacting us. We're investigating this issue. We'll let you know if it's possible to work on this issue.
@ShahryarSaljoughi
Internally, we are using BindConverter.TryConvertTo to convert the string value of the input to the corresponding converted number from it. It's a built-in utility class inside the ASP.NET Core, and we do not have any control over it.
Do you know of any component out there that supports such a feature that you are requesting in this issue?
it seems even providing different cultures ("fa-IR" or "fa") as the input to the BindConverter.TryConvertTo is not going to resolve this issue:
...
BindConverter.TryConvertTo("۱۲۳", CultureInfo.CreateSpecificCulture("fa-IR"), out result);
...