public function __construct($encoding = null) { if (self::$utfMode === null) { self::$utfMode = defined('BX_UTF'); } if (self::$punycodePrefix === null) { self::$punycodePrefix = "xn--"; self::$punycodePrefixLength = self::ByteLength(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") && strlen(SITE_CHARSET) > 0) { $this->encoding = SITE_CHARSET; } elseif (defined("LANG_CHARSET") && strlen(LANG_CHARSET) > 0) { $this->encoding = LANG_CHARSET; } else { $this->encoding = "utf-8"; } }