public function useEncoding($rule)
{
if ($rule->encoding === null) {
return false;
}
if (!function_exists('mb_strtoupper')) {
throw new FilterException('mbstring is required to use ToLower with an encoding.');
}
$this->encoding = (string) $rule->encoding;
$encodings = array_map('strtolower', mb_list_encodings());
if (!in_array(strtolower($rule->encoding), $encodings)) {
throw new FilterException("mbstring does not support the '" . $rule->encoding . "' encoding");
}
return true;
}