3 namespace Masterminds\HTML5\Tests\Parser;
5 use Masterminds\HTML5\Parser\UTF8Utils;
7 class UTF8UtilsTest extends \Masterminds\HTML5\Tests\TestCase
9 public function testConvertToUTF8() {
10 $out = UTF8Utils::convertToUTF8('éàa', 'ISO-8859-1');
11 $this->assertEquals('éà a', $out);
15 * @todo add tests for invalid codepoints
17 public function testCheckForIllegalCodepoints() {
18 $smoke = "Smoke test";
19 $err = UTF8Utils::checkForIllegalCodepoints($smoke);
20 $this->assertEmpty($err);
22 $data = "Foo Bar \0 Baz";
23 $errors = UTF8Utils::checkForIllegalCodepoints($data);
24 $this->assertContains('null-character', $errors);