{
  "id": "php/mb-convert-encoding-illegal-character",
  "signature": "Warning: mb_convert_encoding(): Illegal character encoding specified in /var/www/app/src/Utils/TextCleaner.php on line 18",
  "signature_zh": "警告：mb_convert_encoding()：指定了非法字符编码，位于 /var/www/app/src/Utils/TextCleaner.php 第 18 行",
  "regex": "Warning:\\s*mb_convert_encoding\\(\\):\\s*Illegal\\s*character\\s*encoding\\s*specified",
  "domain": "php",
  "category": "encoding_error",
  "subcategory": null,
  "root_cause": "The encoding name passed to mb_convert_encoding is not recognized by the mbstring extension, often due to a typo or unsupported encoding.",
  "root_cause_type": "generic",
  "root_cause_zh": "传递给 mb_convert_encoding 的编码名称未被 mbstring 扩展识别，通常是由于拼写错误或不支持的编码。",
  "versions": [
    {
      "version": "PHP 8.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PHP 8.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PHP 8.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Setting default_charset in php.ini to a different value does not affect mb_convert_encoding's encoding parameter validation.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Using iconv() instead of mb_convert_encoding may work for some encodings but introduces a new dependency and may not support all encodings.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Passing an empty string as encoding will still trigger this warning because empty is not a valid encoding name.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Verify the encoding name against the list of supported encodings using mb_list_encodings() and correct any typos.",
      "success_rate": 0.95,
      "how": "Verify the encoding name against the list of supported encodings using mb_list_encodings() and correct any typos.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use mb_detect_encoding() to auto-detect the encoding before conversion, with a fallback to a safe encoding like UTF-8.",
      "success_rate": 0.9,
      "how": "Use mb_detect_encoding() to auto-detect the encoding before conversion, with a fallback to a safe encoding like UTF-8.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Verify the encoding name against the list of supported encodings using mb_list_encodings() and correct any typos.",
    "Use mb_detect_encoding() to auto-detect the encoding before conversion, with a fallback to a safe encoding like UTF-8."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.php.net/manual/en/function.mb-convert-encoding.php",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-07-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}