ライブドアブログのRSS(atom.xml)で文字化け

この記事は約1分で読めます。
スポンサーリンク

当サイトには広告が含まれています。

parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0x83 0x6E 0x81 0x5B

ブログRSSから最新の10件を取って表示しようとしたら文字化け。

サイトが古く、文字コードがSJISに対し、RSSはUTF-8なので、文字コードが異なるのだ。

simplexml_load_file

ではなく

file_get_contents

として

mb_convert_encoding

して

simplexml_load_string

してもアレだし。

0x83 0x6E 0x81 0x5B

あたりが気になるので

str_replace

してもアレだし。

サイトをUTF-8にして、文字コードを一致させれば済むのだが、

面倒なので放置wwwwwwwww

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny

タイトルとURLをコピーしました