public function testToUTF8() { $this->assertEquals('UTF-8', mb_detect_encoding(StringUtils::toUTF8('aaa'), 'UTF-8', true)); $this->assertEquals('UTF-8', mb_detect_encoding(StringUtils::toUTF8('accentu�'), 'UTF-8', true)); $this->assertEquals('UTF-8', mb_detect_encoding(StringUtils::toUTF8('reçoivent'), 'UTF-8', true)); $this->assertEquals('UTF-8', mb_detect_encoding(StringUtils::toUTF8('©ÉÇáñ'), 'UTF-8', true)); }
/** * Return a cleaned string. * * @param string $str * * @return string */ protected function _cleanText($str) { return trim(html_entity_decode(html_entity_decode(String::toUTF8($str), ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8')); }