$encoded =
$value;
if (mb_detect_encoding($value, 'auto', true
) !== 'UTF-8'
) { $encoded =
mb_convert_encoding($value, 'UTF-8', 'Windows-1252'
);
} if ($this->
isValid($encoded)) { return $this->charValue
[$encoded];
} if ($this->
isNullType($encoded)) { return self::C_NUL;
} if ($this->
isInvalidChar($encoded)) { $this->hasInvalidTokens = true;
return self::INVALID;
} return self::GENERIC;
}