18 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
19 |
use YAML; |
use YAML; |
20 |
use JSON; |
use JSON; |
21 |
|
#use Encode qw/encode encode_utf8 is_utf8/; |
22 |
|
use Text::Unaccent::PurePerl qw/unac_string/; |
23 |
|
|
24 |
|
|
25 |
=head1 NAME |
=head1 NAME |
170 |
next if ! $vals; |
next if ! $vals; |
171 |
|
|
172 |
$vals =~ s/($escape_re)/$escape{$1}/gs; |
$vals =~ s/($escape_re)/$escape{$1}/gs; |
173 |
|
$data->{$tag} = $vals; |
174 |
|
$vals = unac_string( $vals ); |
175 |
|
|
176 |
# BW & EW are our markers for tag boundry |
# BW & EW are our markers for tag boundry |
177 |
$xml .= qq{<$tag><![CDATA[BW $vals EW]]></$tag>}; |
$xml .= qq{<$tag><![CDATA[BW $vals EW]]></$tag>}; |
178 |
|
# $xml .= qq{<!-- } . is_utf8( $vals ) . qq{!>}; |
179 |
|
|
180 |
$self->{stats}->{attr}->{$tag}++; |
$self->{stats}->{attr}->{$tag}++; |
181 |
$self->{stats}->{input}->{ $self->input }->{$tag}++; |
$self->{stats}->{input}->{ $self->input }->{$tag}++; |
182 |
|
|
|
$data->{$tag} = $vals; |
|
183 |
} |
} |
184 |
|
|
185 |
# serialize to JSON instead of YAML because we will loose whitespace |
# serialize to JSON instead of YAML because we will loose whitespace |
186 |
$data = to_json($data); |
$data = to_json($data, {utf8=>1}); |
187 |
$xml .= qq{<data><![CDATA[$data]]></data>}; |
$xml .= qq{<data><![CDATA[$data]]></data>}; |
188 |
|
|
189 |
$xml .= qq{</all>\n}; |
$xml .= qq{</all>\n}; |
190 |
|
|
191 |
|
# $xml = encode('utf-8', $xml); |
192 |
|
|
193 |
|
use bytes; |
194 |
my $len = length($xml); |
my $len = length($xml); |
195 |
|
|
196 |
my $fh = $self->{_swish_fh} || die "_swish_fh missing"; |
my $fh = $self->{_swish_fh} || die "_swish_fh missing"; |