parsedown-extra
parsedown-extra copied to clipboard
parsedown extra (in grav cms): problem with abbreviation definition ending czech
Moving this issue from: https://github.com/erusev/parsedown/issues/616
Quoting @oufloued:
had this problem with abbreviation definition ending with czech characters. ( which are quite common in czech republic ;) anyway same problem with deutschem Ää et al ) the u modifier solved it.
found on: https://stackoverflow.com/questions/1766485/are-the-php-preg-functions-multibyte-safe#answer-1766767
not sure though about that. what do you think?
PHP 7.0.27-0+deb9u1 (cli) (built: Jan 5 2018 13:51:52) ( NTS )
//contains original code from ParsedownExtra.php, modified to demonstrate … $text = 'Františkovy Lázně foreva'; //works only with the u modifier //$text = 'Františkovy Lázněforeva'; //works without the u modifier $abbreviation = 'Františkovy Lázně'; $meaning = 'Franzensbad'; //original: $pattern = '/\b'.preg_quote($abbreviation, '/').'\b/'; $pattern = '/\b'.preg_quote($abbreviation, '/').'\b/u'; $text = preg_replace($pattern, '<abbr title="'.$meaning.'">'.$abbreviation.'</abbr>', $text); print_r($text);