• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/punycode.php
  • Класс: CBXPunycode
  • Вызов: CBXPunycode::__construct
public function __construct($encoding = null)
{
	if (self::$utfMode === null)
		self::$utfMode = defined('BX_UTF');

	if (self::$punycodePrefix === null)
	{
		self::$punycodePrefix = "xn--";
		self::$punycodePrefixLength = strlen(self::$punycodePrefix);
		self::$punycodePrefixUcs4 = $this->Utf8ToUcs4(self::$punycodePrefix);
	}

	if (self::$prefixUcs4 === null)
		self::$prefixUcs4 = $this->Utf8ToUcs4(self::PREFIX);

	if (self::$hyphenUcs4 === null)
		self::$hyphenUcs4 = $this->Utf8ToUcs4("-");

	if (!is_null($encoding))
		$this->encoding = $encoding;
	elseif (self::$utfMode)
		$this->encoding = "utf-8";
	elseif (defined("SITE_CHARSET") && (SITE_CHARSET <> ''))
		$this->encoding = SITE_CHARSET;
	elseif (defined("LANG_CHARSET") && (LANG_CHARSET <> ''))
		$this->encoding = LANG_CHARSET;
	else
		$this->encoding = "utf-8";
}