validator.js icon indicating copy to clipboard operation
validator.js copied to clipboard

Bug in isAlphanumeric

Open UMFsimke opened this issue 4 years ago • 3 comments

When checking if string is alphanumeric with croatian and serbian letters different results are got, although they should be the same.

Example: validator.isAlphanumeric('Ðina', 'sr-RS@latin') will return false, while validator.isAlphanumeric('Đina', 'sr-RS@latin') will return true. If you take a look into UTF-8 encoding difference is that the first letter Ð is \xc3\x90 and second Đ is \xc4\x90 while essentially they are the same.

Validator.js version: ^13.6.0 Node.js version: 12 OS platform: docker

UMFsimke avatar Sep 16 '21 15:09 UMFsimke

Hello @UMFsimke, According to the sources i found, the correct code for D with stroke as used in the serbian and croatian alphabet is U+0110 in UTF-8 code point or if you prefer \xc4\x90 . The other Ð ( U+00D0or \xc3\x90 ) called Eth is used in Scandinavia and old English and is not a valid serbian latin alphabet character even if the two characters look the same.

tux-tn avatar Sep 20 '21 14:09 tux-tn

Is this issue still open? I would like to work on this

vibhuti019 avatar Oct 09 '21 20:10 vibhuti019

@vibhuti019 we need to define if it's a valid issue before

tux-tn avatar Oct 09 '21 21:10 tux-tn