• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/text/encoding.php
  • Класс: BitrixMainTextEncoding
  • Вызов: Encoding::detectUtf8
static function detectUtf8($string, $replaceHex = true)
{
	if ($replaceHex)
	{
		$string = preg_replace_callback(
			"/(%)([\dA-F]{2})/i",
			function ($match) {
				return chr(hexdec($match[2]));
			},
			$string
		);
	}

	return (bool)preg_match('//u', $string);
}