Can’t match to Japanese word
-
Thank you for the great plugin.
However, when I specify a Japanese word as Replace Keyword in Replacements, it is not converted.
I checked the code and found thatclass-url-shortener-public.php
$pattern = '#(?! <. *?) (\b'.preg_quote($keyword).' \b)(?! [^<>]*? >)#si';
If this \b is present, the Japanese will not match. If remove it, it will match. I modified the code as follows and it is working fine.
if ( strlen( $keyword ) != mb_strlen( $keyword, 'utf8' ) ) { // have multibyte language $pattern = '#(?!<.*?)(' . preg_quote( $keyword ) . ')(?![^<>]*?>)#si'; } else { // have not multibyte language $pattern = '#(?!<.*?)(\b' . preg_quote( $keyword ) . '\b)(?![^<>]*?>)#si'; }
Thanks.
- The topic ‘Can’t match to Japanese word’ is closed to new replies.