Module encoding

Module encoding 

Source
Expand description

Encoding detection and conversion utilities

This module provides functions for detecting character encoding and converting to UTF-8.

Encoding detection follows this priority order:

  1. BOM (Byte Order Mark) - highest priority
  2. HTTP Content-Type charset (if provided)
  3. XML declaration encoding attribute
  4. Default to UTF-8

Functionsยง

convert_to_utf8
Convert data to UTF-8 from detected encoding
detect_and_convert
Detect encoding and convert to UTF-8 in one step
detect_encoding
Detect character encoding from byte data
detect_encoding_with_hint
Detect encoding with optional HTTP Content-Type hint
extract_charset_from_content_type
Extract charset from HTTP Content-Type header