Persian keyboards produce a distinct set of numeral characters that look like normal numbers but live in a separate Unicode block. That mismatch silently breaks search, sorting, and numeric parsing. This converter swaps digits in either direction while leaving everything else intact.
How it works
Two simple character maps drive the conversion. Going from Western to Persian,
each ASCII digit 0-9 is replaced with its counterpart in the Persian
Extended Arabic-Indic block:
0 → ۰ (U+06F0) 5 → ۵ (U+06F5)
1 → ۱ (U+06F1) 6 → ۶ (U+06F6)
4 → ۴ (U+06F4) 9 → ۹ (U+06F9)
Going the other way, the tool matches any character in the Persian block (U+06F0–U+06F9) or the standard Arabic-Indic block (U+0660–U+0669) and subtracts the block offset to recover the Western digit. Every non-digit character passes through a no-op branch, so formatting is preserved.
Example and notes
Converting Order 12345 — قیمت ۹۸۷ to Western gives Order 12345 — قیمت 987;
the Arabic text and the already-Western run are untouched. Note that Persian and
Arabic share most digit shapes but differ on four, six, and seven — this tool
normalises both to Western, which is the safest target for any system that needs
to parse the values as numbers.