Warning: mb_convert_encoding(): Unable to detect character encoding

エラーメッセージWarning

警告メッセージ

 状態:-  閲覧数:2,520  投稿日:2017-03-09  更新日:2017-03-09  
Warning: mb_convert_encoding(): Unable to detect character encoding


原因


第3引数で"auto"指定しているため
・変換前の文字エンコーディング


遭遇例


修正前
echo mb_convert_encoding($e->innertext . '<br>', 'UTF-8', 'AUTO');

修正後
echo mb_convert_encoding($e->innertext . '<br>', 'UTF-8', 'SJIS');



mb_convert_encodingのautoが危険な理由


Warning: session_write_close(): Failed to write session data (user)

Warning: PDO::query(): LOAD DATA LOCAL INFILE forbidden

コメント投稿(ログインが必要)



週間人気ページランキング / 11-13 → 11-19
順位 ページタイトル抜粋 アクセス数
1 curl で Cookie を使用する 4
2 Warning: strlen() expects parameter 1 to be string, array given in ○○.php on line △△ | Warning(エラーメッセージ) 3
2 Catchable fatal error: Object of class DateTime could not be converted to string | Fatal error(エラーメッセージ) 3
2 セッション管理が必要な理由は、HTTPプロトコルには状態を保持する機能がないため | セッション 3
3 歴史 カテゴリー 2
3 コード例 … 「例外処理」はネストすることができる 2
3 オブジェクト関係マッピング | データベース関連 2
3 ブラウザを閉じたらセッションデータはどうなるの? | セッション 2
3 Parse error: syntax error, unexpected 'public' (T_PUBLIC) | Parse error(エラーメッセージ) 2
3 Fatal error: Uncaught RuntimeException: SplFileObject::__construct(): failed to open stream: Permission denied in | Fatal error(エラーメッセージ) 2
3 Cookie | クッキー 2
3 PHPで定数を定義する方法は2種類ある / 配列定数の定義 2
3 Fatal error: Uncaught Error: Call to a member function modify() on string | Fatal error(エラーメッセージ) 2
3 その他のサービス カテゴリー 2
3 サニタイズ | セキュリティ 2
3 Generator クラス(定義済みのインターフェイスとクラス) カテゴリー 2
3 Fatal error: Non-abstract method クラス名::メソッド名 must contain body in ○○.php on line △△ | Fatal error(エラーメッセージ) 2
4 Warning: Division by zero | Warning(エラーメッセージ) 1
4 for文 | 制御構造 1
4 セッション名 | セッション 1
2025/11/20 1:01 更新