2021年3月14日星期日

Prevent Smart Quotes on HTML5 Input

Had an annoying issue with my web application more recently. Using HTML5, a user can create an account with a login ID. The ID can contain pretty much any character. A user will enter an account ID, for example

Bob'sAccount

And their device (unknown to them) turns the ' into a "smartquote" with the ` style apostrophe

So now their account is created (with a smartquote in the user ID0. However, if they try to log in using a device which doesn't automatically create smart quotes, they try to log in using the standard apostrophe, and since it's a different character their account is not found.

I'm sure I could limit the characters a user can enter for an account ID, but I would rather just prevent the smartquotes from happening in the first place.

Is there a way to disable "smartquotes" in an HTML5 input field?

https://stackoverflow.com/questions/66631493/prevent-smart-quotes-on-html5-input March 15, 2021 at 10:04AM

没有评论:

发表评论