Skip to content

Arabic / Persian digit input fails validation #2105

@M0hammad124

Description

@M0hammad124

When users type phone numbers using Arabic or Persian keyboards, intlTelInput blocks their input.
The reason is that the library validates key presses using /^[0-9]$/, which matches only ASCII digits (U+0030–0039).
Arabic and Persian digits are different Unicode code points.

Steps to reproduce:
1- Load intl-tel-input on any input. (strictMode: true)
2- Switch your keyboard to Arabic or Persian.
3- Try typing a number — input is rejected.

Expected behavior:
Arabic and Persian digits should be accepted and normalized to ASCII internally.

Suggested fix:
normalize the key before validations using:

const asciiDigit = key.replace(/[٠-٩]/g, c => String(c.charCodeAt(0) - 1632))
                      .replace(/[۰-۹]/g, c => String(c.charCodeAt(0) - 1776));

or replace the:

^[0-9]$

with:

^[0-9\u0660-\u0669\u06F0-\u06F9]$

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions