Alvis-Convert
view release on metacpan or search on metacpan
lib/Alvis/Document/Encoding.pm view on Meta::CPAN
# Error message stuff
#
#############################################################################
my $ErrStr;
my ($ERR_OK,
$ERR_ILLEGAL_CODE,
$ERR_DOC,
$ERR_DOC_TYPE,
$ERR_DOC_SUB_TYPE,
$ERR_BOM,
$ERR_FIRST_CHARS,
$ERR_META,
$ERR_XML,
$ERR_GUESS,
$ERR_WRONG_GUESS,
$ERR_ILLEGAL_CHAR,
$ERR_DOC_TYPE_WIZARD,
$ERR_TYPE_GUESS,
$ERR_ENCODE_GUESS,
$ERR_GUESS_AND_CONVERT,
$ERR_UNABLE_TO_GUESS
)=(0..16);
my %ErrMsgs=($ERR_OK=>"",
$ERR_ILLEGAL_CODE=>"Illegal UTF-8 code.",
$ERR_DOC=>"No document text.",
$ERR_DOC_TYPE=>"No document type.",
$ERR_DOC_SUB_TYPE=>"No document subtype.",
$ERR_BOM=>"Byte order mark recognition failed miserably.",
$ERR_FIRST_CHARS=>"Guessing from the first characters " .
"failed miserably.",
$ERR_META=>"Guessing from the meta information " .
"failed miserably.",
$ERR_XML=>"Guessing from XML format failed miserably.",
$ERR_GUESS=>"Unable to guess at the encoding.",
$ERR_WRONG_GUESS=>"This pair does not convert:",
$ERR_ILLEGAL_CHAR=>"Illegal character in supposedly UTF-8 " .
"result.",
$ERR_DOC_TYPE_WIZARD=>"Instantiating Alvis::Document::Type",
lib/Alvis/Document/Encoding.pm view on Meta::CPAN
}
my @guesses;
eval
{
@guesses=HTML::Encoding::encoding_from_byte_order_mark($text,xhtml=>0);
};
if ($@)
{
$self->_set_err_state($ERR_BOM,"$@");
}
if (scalar(@guesses))
{
return @guesses;
}
# Sanity check to exclude e.g. UTF-32
#
eval
{
( run in 0.489 second using v1.01-cache-2.11-cpan-f29a10751f0 )