All is fine when I use Latin characters:
[spoiler=test]test[/spoiler]
But the spoiler is not displayed correctly when I use the Cyrillic characters:
[spoiler=тест]test[/spoiler]
How can I fix it? I use Vanilla 2.0.18.1. Thanks in advance you for answers.
Answers
Found the answer. It is necessary to change the line 57:
$Data->Body = preg_replace_callback("/(\[spoiler(?:=\"?([\d\w_',.? ]+)\"?)?\])/", array($this, 'SpoilerCallback'), $Data->Body);to:
$Data->Body = preg_replace_callback("/(\[spoiler(?:=\"?([\d\w_абвгдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ«»',.? ]+)\"?)?\])/", array($this, 'SpoilerCallback'), $Data->Body);I would be grateful if someone will confirm or disprove the correctness of this decision.
use
[\d\p{L}_',\.\?]+that will match any kind of letter in any language.
[\d\w\p{Cyrillic}_',\.\?]+for Cyrillic and standard Latin
grep is your friend.
Sorry, x00, but it doesn't work. Does p{L} and p{Cyrillic} ranges include " character? It may be a cause of problem, I guess.
I think you need the u modifier so
$Data->Body = preg_replace_callback("/(\[spoiler(?:=\"?([\d\p{L}_',\.\?]+)\"?)?\])/ui", array($this, 'SpoilerCallback'), $Data->Body);the i modifier makes it case insensitive.
grep is your friend.
you could try а-яА-Я
grep is your friend.
the prior example is dependent on you version of php and PCRE
grep is your friend.
It works with string:
$Data->Body = preg_replace_callback("/(\[spoiler(?:=\"?([\d\p{L}_\-—«»',.?! ]+)\"?)?\])/ui", array($this, 'SpoilerCallback'), $Data->Body);Thank you for your help, x00.
No worries my friend.
grep is your friend.