charset = $charset; } public function validate($input) { $detectedEncoding = mb_detect_encoding($input, $this->charset, true); return in_array($detectedEncoding, $this->charset, true); } }