Webqq/Message/XMLescape.pm untested

filter: Statementstmt 0.0% 0 / 12 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 18 CC 2 SCAR 13.9
CC
2
Cov
0%
Mojo::Webqq::xmlescape_parse
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 4.0
1 #my %XML_ESCAPE_MAP = (
2 # '&' => '&',
3 # '&lt;' => '<',
4 # '&gt;' => '>',
5 # '&quot;' => '"',
6 # '&#39;' => '\'',
7 # '&apos;' => '\'',
8 # '&nbsp;' => ' ',
9 # '&#92;' => "\\",
10 #);
11 use Encode ();
12 use Mojo::Util qw();
13 sub Mojo::Webqq::xmlescape_parse {
14 my $self = shift;
15 my $data = shift;
16 return $data if not defined $data;
17 $data=~s/&nbsp;/ /g;
18 my $unicode_data = Mojo::Util::html_unescape(Encode::decode("utf8",$data));
19 #my $newdata = Mojo::Util::html_unescape($data);
20 #eval {
21 # if ($data =~ /\&/ or $newdata =~ /[><&]/) {
22 # $newdata = Encode::decode('utf8', $newdata);
23 # Encode::_utf8_off($newdata);
24 # }
25 #};
26 #return $newdata;
27 #return $data;
28 return Encode::encode("utf8",$unicode_data);
29 }
30 1;