beholdr / maska

Simple zero-dependency input mask for Alpine.js, Svelte, Vue.js and vanilla JS.

Home Page:https://beholdr.github.io/maska

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

doesnt accept áéí (accents)

joseehilton147 opened this issue · comments

Describe the bug

Im from Brazil, so here we have accents in a lot of words, but using maska i cant use accents, doesnt accept it.

Reproduction link

https://stackblitz.com/edit/vue-maska-3xo7dd?file=src%2FApp.vue

Because * token accepts only latin letters:

'*': { pattern: /[a-zA-Z0-9]/ }

You could use custom token to accept other symbols.

isn't a thing the plugin should implement? There are a lot of languages who have accents and on this way the plugin is limited to languages who do have it.

I've stopped using the plugin for this, i need to validate some fields but need to allow accents so i ended up with this: /[^a-zA-ZÀ-ÿ0-9\s]/g

and because that's no point to use the plugin because some cases works for me like numbers and others not.

Anyway ty for the answer.

It’s hard to account for all cases. You can add a custom token or redefine the default token for your case.

Like this to allow any character:

<input v-maska data-maska="**********" data-maska-tokens="*:." />

Or for given characters:

<input v-maska data-maska="**********" data-maska-tokens="*:[a-zA-ZÀ-ÿ0-9]" />