Created
May 30, 2014 14:44
-
-
Save sasezaki/b0ddd522f5c60537a2e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\DomCrawler\Crawler; | |
require 'vendor/autoload.php'; | |
$html = mb_convert_encoding('<html><head><meta charset="Shift_JIS"></head><body>日本語①②③</body></html>', 'SJIS-win', 'UTF-8'); | |
$crawler = new Crawler; | |
$crawler->addContent($html); | |
var_dump($crawler->filterXPath('//body')->text()); // string(9) "日本語" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment