You will eventually have to deal with character sets, fonts, RTL support, Hijri calendar, date time and numbers while working on a bilingual project in the Middle East.
Today we will discuss the Arabic numbers input. According to the code charts, U+0660 to U+0669 are ARABIC-INDIC DIGIT values 0 through 9, while U+06F0 to U+06F9 are EXTENDED ARABIC-INDIC DIGIT (Urdu) values 0 through 9.
Visit for more about Unicode: unicodeplus.com
U+06F5 – 'Urdu glyph for number 5'
U+0665 - 'Arabic glyph for number 5'
If you are working with Arabic from the Middle East, use the U+066n series of digits; if you are working with Urdu, use the U+06Fn series of digits.
In case you want to replace the Arabic number with English number, I am sharing the code from one of my apps below:
Example in C#
var dictionary = new Dictionary<string, string>
{
{"٠", "0"},{"١", "1"},{"٢", "2"},{"٣", "3"},
{"٤", "4"},{"٥", "5"},{"٦", "6"},{"٧", "7"},
{"٨", "8"},{"٩", "9"},
};
string digit = input.Substring(this. txtNumber.Text.Length - 1);
char[] NumberChars = "٠١٢٣٤٥٦٧٨٩0123456789".ToCharArray();
int indexOf = digit.IndexOfAny(NumberChars);
if (indexOf == -1)
{
input = input.Remove(input.Length - 1);
await DisplayAlert("", "الحروف لا تقبل", "تم");
}
else
{
if (!string.IsNullOrEmpty(input) && dictionary.ContainsKey(digit)))
{
string englishDigit = dictionary[input];
input = input.Replace(digit, englishDigit);
}
}
You have to enable the Arabic Charset or Unicode while storing these number into the database.