[whatwg] Changing punctuation value of input element in telephone state

Eduard Pascual herenvardo at gmail.com
Tue Apr 6 16:28:21 PDT 2010


On Wed, Apr 7, 2010 at 1:10 AM, Ian Hickson <ian at hixie.ch> wrote:
> If there was a true standard, then the spec would refer to that, but as
> you say, it's very varied in practice.

There is quite a standard, even if an implicit one: (almost) no punctuation.
Have you ever dialed a "(" or a "-" when phoning someone? In essence,
phone numbers are sequences of digits, and punctuation is only used as
a convenience to enhance readability.
There are two exceptions to this: "+" and letters are used as
replacement for numbers (the plus sign for the international call
code, the letters for specific digits to enable creating "branded"
numbers easier to memorize).

Maybe I'm being too hasty with this idea but, since machines don't
really need the same readability aids as humans do, I'd suggest that
the UA simply removes everything other than "+" and alphanumeric
characters (and obviously adds nothing) when sending the field. I
don't care too much about what they do upon rendering the introduced
value (and I think it's probably fine if the browser adds some
formatting based on its own or the system's regional settings). The
server is only left with replacing letters and "+"; plus any
application-specific usage of the value itself (which, by then, will
be a string of digits; assumedly representing the sequence of digits
to dial).

Other than that, the only safe alternative would be to leave the
values untouched, so the page can say what it wants, the user honor
it, and the server get it as expected; or gracefully degrade to an
error message that actually points to the user error (rather than an
error introduced by an UA trying to be out-smart the user).

For sites that are ready to sanitize values from a specific locale;
but which are accessed through an UA with different settings (ie: on a
public place while abroad), the UA adding locale-specific stuff to a
phone value is very likely to render whole forms unusables.

Regards,
Eduard Pascual



More information about the whatwg mailing list