Variable "anchor" no work to russian language
nefeloget opened this issue · comments
Vyacheslav Velichko commented
Problems in code:
var anchor = title.toLowerCase().replace(/[^\w]+/g, '-');
Solution:
var anchor = title.toLowerCase().replace(/[^A-Za-z0-9_А-Яа-яЁё]+/g, '-');
or
var anchor = title.toLowerCase().replace(/\ /g, '-');
Anyway currently works only with Latin characters, which is bad.
Daniel Ruf commented
Variables / code which use non-latin characters are an anti-pattern that you should avoid.
If we would have to support every language we would have to adjust the regex. That makes not much sense.