Hi!
> That said, how do you feel about compromising by adding this function
> in addition to the raw API?
>
> function ucsdet_detect_encoding(string $text, string $hint = null,
> bool $filter = false) {
> $det = new IntlCharsetDetector($text);
> if ($hint !== null) {
> $det->setDeclaredEncoding($hint);
> }
> $det->enableInputFiltering($filter);
> return $det->detect()['name'];
> }
That works too, but object one has its uses - e.g. preparing one
detector and detecting multiple texts, like library, etc. Of course, one
can do setText, but it's extra hop that doesn't seem to add anything.
I'd take both :)
--
Stas Malyshev
[email protected]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php