public $errors = array
();
/**
* Create a new InputStream wrapper.
*
* @param string $data Data to parse.
* @param string $encoding The encoding to use for the data.
* @param string $debug A fprintf format to use to echo the data on stdout.
*/
public function __construct($data,
$encoding = 'UTF-8',
$debug = ''
) { $data = UTF8Utils::
convertToUTF8($data,
$encoding);
if ($debug) { fprintf(STDOUT,
$debug,
$data,
strlen($data));
} // There is good reason to question whether it makes sense to
// do this here, since most of these checks are done during
// parsing, and since this check doesn't actually *do* anything.
$this->errors = UTF8Utils::
checkForIllegalCodepoints($data);
$data =
$this->
replaceLinefeeds($data);