.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Encode::Detect::Detector 3pm" .TH Encode::Detect::Detector 3pm 2024-01-10 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Encode::Detect::Detector \- Detects the encoding of data .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& use Encode::Detect::Detector; \& my $charset = detect($octets); \& \& my $d = new Encode::Detect::Detector; \& $d\->handle($octets); \& $d\->handle($more_octets); \& $d\->end; \& my $charset = $d\->getresult; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This module provides an interface to Mozilla's universal charset detector, which detects the charset used to encode data. .SH METHODS .IX Header "METHODS" .ie n .SS "$charset = Encode::Detect::Detector\->detect($octets)" .el .SS "\f(CW$charset\fP = Encode::Detect::Detector\->detect($octets)" .IX Subsection "$charset = Encode::Detect::Detector->detect($octets)" Detect the charset used to encode the data in \f(CW$octets\fR and return the charset's name. Returns undef if the charset cannot be determined with sufficient confidence. .ie n .SS "$d = Encode::Detect::Detector\->\fBnew()\fP" .el .SS "\f(CW$d\fP = Encode::Detect::Detector\->\fBnew()\fP" .IX Subsection "$d = Encode::Detect::Detector->new()" Creates a new \f(CW\*(C`Encode::Detect::Detector\*(C'\fR object and returns it. .ie n .SS $d\->handle($octets) .el .SS \f(CW$d\fP\->handle($octets) .IX Subsection "$d->handle($octets)" Provides an additional chunk of data to be examined by the detector. May be called multiple times. .PP Returns zero on success, nonzero if a memory allocation failed. .ie n .SS $d\->eof .el .SS \f(CW$d\fP\->eof .IX Subsection "$d->eof" Informs the detector that there is no more data to be examined. In many cases, this is necessary in order for the detector to make a decision on the charset. .ie n .SS $d\->reset .el .SS \f(CW$d\fP\->reset .IX Subsection "$d->reset" Resets the detector to its initial state. .ie n .SS $d\->getresult .el .SS \f(CW$d\fP\->getresult .IX Subsection "$d->getresult" Returns the name of the detected charset or \f(CW\*(C`undef\*(C'\fR if no charset has (yet) been decided upon. May be called at any time. .SH "SEE ALSO" .IX Header "SEE ALSO" Encode::Detect .SH AUTHOR .IX Header "AUTHOR" John Gardiner Myers .SH SUPPORT .IX Header "SUPPORT" For help and thank you notes, e\-mail the author directly. To report a bug, submit a patch, or add to the wishlist please visit the CPAN bug manager at: \fIhttp://rt.cpan.org\fR