1Encode::Detect::DetectoUrs(e3r)Contributed Perl DocumentEantcioodne::Detect::Detector(3)
2
3
4
6 Encode::Detect::Detector - Detects the encoding of data
7
9 use Encode::Detect::Detector;
10 my $charset = detect($octets);
11
12 my $d = new Encode::Detect::Detector;
13 $d->handle($octets);
14 $d->handle($more_octets);
15 $d->end;
16 my $charset = $d->getresult;
17
19 This module provides an interface to Mozilla's universal charset
20 detector, which detects the charset used to encode data.
21
23 $charset = Encode::Detect::Detector->detect($octets)
24 Detect the charset used to encode the data in $octets and return the
25 charset's name. Returns undef if the charset cannot be determined with
26 sufficient confidence.
27
28 $d = Encode::Detect::Detector->new()
29 Creates a new "Encode::Detect::Detector" object and returns it.
30
31 $d->handle($octets)
32 Provides an additional chunk of data to be examined by the detector.
33 May be called multiple times.
34
35 Returns zero on success, nonzero if a memory allocation failed.
36
37 $d->eof
38 Informs the detector that there is no more data to be examined. In
39 many cases, this is necessary in order for the detector to make a
40 decision on the charset.
41
42 $d->reset
43 Resets the detector to its initial state.
44
45 $d->getresult
46 Returns the name of the detected charset or "undef" if no charset has
47 (yet) been decided upon. May be called at any time.
48
50 Encode::Detect
51
53 John Gardiner Myers <jgmyers@proofpoint.com>
54
56 For help and thank you notes, e-mail the author directly. To report a
57 bug, submit a patch, or add to the wishlist please visit the CPAN bug
58 manager at: http://rt.cpan.org
59
60
61
62perl v5.26.3 2019-05-14 Encode::Detect::Detector(3)