function __construct( $source, Features
$features,
$options ) { $this->features =
$features;
$encoding =
isset($options["sourceEncoding"
]) ?
$options["sourceEncoding"
] :
null;
//Strip BOM characters from the source
$this->
stripBOM($source,
$encoding);
//Convert to UTF8 if needed
if ($encoding && !
preg_match("/UTF-?8/i",
$encoding)) { $source =
mb_convert_encoding($source, "UTF-8",
$encoding);
} //Instead of using mb_substr for each character, split the source
//into an array of UTF8 characters for performance reasons
$this->source = Utils::
stringToUTF8Array( $source,
!
isset($options["strictEncoding"
]) ||
$options["strictEncoding"
] );