if (('utf-8' !==
$inCharset && !self::
loadMap('from.',
$inCharset,
$inMap)) || ('utf-8' !==
$outCharset && !self::
loadMap('to.',
$outCharset,
$outMap))) { trigger_error(sprintf(self::ERROR_WRONG_CHARSET,
$inCharset,
$outCharset));
return false;
} if ('utf-8' !==
$inCharset) { // Convert input to UTF-8
$result = '';
if (self::
mapToUtf8($result,
$inMap,
$str,
$ignore)) { $str =
$result;
} else { $str = false;
} self::
$isValidUtf8 = true;
} else { self::
$isValidUtf8 =
preg_match('//u',
$str);
if (!self::
$isValidUtf8 && !
$ignore) { trigger_error(self::ERROR_ILLEGAL_CHARACTER
);