• Takego

    (@take83)


    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 that

    class-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.

    • This topic was modified 3 years ago by Takego.
  • The topic ‘Can’t match to Japanese word’ is closed to new replies.