私はサイトの imdb データスクレーパーに取り組んでいますが、これまでに見たことのない奇妙なエンコーディングですべてをエンコードしているようです。
<a href="/keyword/exploding-ship/">Exploding Ship</a>
A Bug's Life
これらを通常の文字に変換するphp関数はありますか?
私はサイトの imdb データスクレーパーに取り組んでいますが、これまでに見たことのない奇妙なエンコーディングですべてをエンコードしているようです。
<a href="/keyword/exploding-ship/">Exploding Ship</a>
A Bug's Life
これらを通常の文字に変換するphp関数はありますか?
これはエンコーディングではなく、html エンティティの 16 進コードです。
試す
$converted = html_entity_decode($string, ENT_QUOTES, 'UTF-8');
これらは SGML 文字エスケープです。'
10 進数 ( ) または 16 進数( ) のいずれか 
で、Unicode コード ポイントを直接参照します。
html_entity_decode()は PHP 5 で動作するはずですが、現時点ではテストできません。
そのリファレンス ページの最初のコメントでは、古い PHP バージョンの次のコードが示されています。
// For users prior to PHP 4.3.0 you may do this:
function unhtmlentities($string)
{
// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr("\\1")', $string);
// replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}