Warning: mb_convert_encoding(): Unable to detect character encoding

エラーメッセージWarning

警告メッセージ

 状態:-  閲覧数:2,550  投稿日: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

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



週間人気ページランキング / 12-25 → 12-31
順位 ページタイトル抜粋 アクセス数
1 Notice(エラーメッセージ) カテゴリー 4
2 PHPにおけるメソッドのオーバーライドについて /「引数の数や型は、親クラスのメソッドと完全に一致していなければなりません。」とは具体的にどういう意味ですか? 3
2 PHPで定数を定義する方法は2種類ある / 配列定数の定義 3
2 Parse error: syntax error, unexpected 'public' (T_PUBLIC) | Parse error(エラーメッセージ) 3
3 「POSIX正規表現」と「PCRE正規表現」の違い 2
3 ( ! ) Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined | Fatal error(エラーメッセージ) 2
3 Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting | エラーメッセージ 2
3 http_build_query | URLs(関数) 2
3 or(||) | 演算子 2
3 No route found fo | エラーメッセージ 2
3 and | 演算子 2
4 Fatal error: Uncaught RuntimeException: SplFileObject::__construct(): failed to open stream: Permission denied in | Fatal error(エラーメッセージ) 1
4 curl で Cookie を使用する 1
4 文字列型(string) | 型 1
4 You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal. | Twitter API(エラーメッセージ) 1
4 Catchable fatal error: Object of class DateTime could not be converted to string | Fatal error(エラーメッセージ) 1
4 セッション管理が必要な理由は、HTTPプロトコルには状態を保持する機能がないため | セッション 1
4 Fatal error: Uncaught Error: Call to a member function modify() on string | Fatal error(エラーメッセージ) 1
4 Warning: strlen() expects parameter 1 to be string, array given in ○○.php on line △△ | Warning(エラーメッセージ) 1
4 ob紛らわしい関数()一覧 | 出力バッファリング制御(関数) 1
2026/1/1 1:01 更新