Karaca-Tech / string-mask

MIT License
8 stars 2 forks source link

[Bug]: Problem with Turkish chars #5

Closed onursimsek closed 1 month ago

onursimsek commented 1 month ago

What happened?

Masking is incorrect when using Turkish characters in text.

How to reproduce the bug

Example text: Onur Şimşek Expect: O* Ş*** Actual: O* Ş*****

there are extra two masking chars because Şimşek have two Turkish chars

Package Version

latest

PHP Version

8.2.10

Which operating systems does with happen with?

Linux

Notes

No response

uutkukorkmaz commented 1 month ago

Here, the root cause is the use of strlen in the processors. Since the strlen function doesn't count multibyte characters and the Turkish letters are multibyte, it seems an extra asterisk is added during the masking process. Will fix asap