public function testSelfTransformerNonUTF8Content() { $json_file = file_get_contents('src/Facebook/InstantArticles/Parser/instant-articles-rules.json'); $instant_article = InstantArticle::create(); $transformer = new Transformer(); $transformer->loadRules($json_file); $html_file = file_get_contents(__DIR__ . '/instant-article-example-nonutf8.html'); $transformer->transformString($instant_article, $html_file, 'euc-jp'); $instant_article->withCanonicalURL('http://foo.com/article.html'); $instant_article->addMetaProperty('op:generator:version', '1.0.0'); $instant_article->addMetaProperty('op:generator:transformer:version', '1.0.0'); $result = $instant_article->render('', true) . "\n"; // some fragments are written as html entities even after transformed so // noralize all strings to html entities and compare them. $this->assertEquals(mb_convert_encoding($html_file, 'HTML-ENTITIES', 'euc-jp'), mb_convert_encoding($result, 'HTML-ENTITIES', 'utf-8')); }