私はこのコードを使用します:
$wpCharset = "UTF8" //or any other charset
//http://php.net/manual/en/domdocument.loadhtml.php#74777
$content = mb_convert_encoding($content, 'HTML-ENTITIES', $wpCharset);
$dom = new DOMDocument('1.0', $wpCharset);
$success = $dom->loadHtml('<!DOCTYPE html><html><meta http-equiv="Content-Type" content="text/html; charset=' . $wpCharset . '" /><body>' . $content);
問題は、機能する "mbstring" 拡張機能がサーバーにインストールされていないユーザーがいるということです。この場合、mb_convert_encoding の代替手段はありますか?
どうもありがとう