Numeric input must accept local formats
Aliases: localized number parsing · international numeric input · locale number parser
What it is
Locale-aware numeric input lets people enter quantities using familiar digits, decimal and grouping marks, signs, and spaces, then converts the result into a canonical numeric value. It does not mean accepting commas and dots indiscriminately. A parser needs the field locale, unit, and allowed precision, and must ask for clarification when an input has two defensible numeric interpretations.
Why it happens
Keyboards, pasted sources, and numbering systems can produce different Unicode characters, while the same comma is decimal in one locale and grouping in another. Only decimal digits in Unicode General Category Nd can be mapped directly by positional value to 0–9; Roman numerals, superscripts, fractions, and CJK numerals with numeric values are not automatically positional input. A reliable path normalizes approved characters under one locale, verifies that the parse position reaches the end after permitted outer whitespace, then validates range and precision and echoes the value. Consequential fields should also reject anomalous mixed digit scripts.
Where it stops holding
Free-text search may use permissive number recognition, while amounts, doses, and measurements require stricter confirmation. Parsing several locales simultaneously creates conflicts, especially with one separator followed by three digits, or whenever several candidate locales fully accept the same string but produce different values. A dot and comma in an order valid for one locale can instead help distinguish conventions. Multinational operators need an explicit data-format choice or interpretation preview. Telephone numbers, account identifiers, and postal codes are identifiers, not quantity input.
Applying it
- Define field locale, numeric type, range, precision, unit, and grouping allowance as the parsing contract; align hints and software keyboard with it.
- Choose strict or controlled lenient parsing by field risk. Accept characters explicitly supported or equivalently mapped by the locale; require correction or confirmation for invalid grouping, anomalous mixed scripts, or multiple interpretations in consequential submissions.
- Echo the complete value in canonical local form before blur or submission. Show unit or currency for consequential fields so users can confirm the interpretation.
- Test spreadsheet paste, keyboards, dictation, bidi marks, NBSP/NNBSP, fullwidth and local
Nddigits, mixed scripts, extreme magnitudes, and precision, and verify that a parser never accepts only a valid prefix.
Related
- Same group: S2.02.1 Decimal and grouping separators swap across regions · S2.02.2 Digit groups are not always three digits · S2.02.3 Negative-number notation varies
- Adjacent: S2.03 Currency and prices · S2.04 Measurement systems
- Search terms:
locale-aware number parsing·localized numeric input·Unicode digits