ODF-lpOD_Helper

 view release on metacpan or  search on metacpan

t/60_encoding.t  view on Meta::CPAN


my $orig_xmltext;
{ my $obj = MyXML->new($orig_path);
  ($orig_xmltext, my $enc) = $obj->get_content();
  ok($enc eq "UTF-8", "Default odf encoding is UTF-8");
  $orig_xmltext =~ qr/\Q$teststring\E/ or die "'$teststring' NOT FOUND!";
}

# N.B. All these encodings still map 0-127 to ASCII, so it is possible
# to parse the xml header when re-reading.  This is not the case, for example,
# with UTF-16 (which depends on BOM detection).
for my $alt_enc (qw/UTF-8 big5 euc-kr x-sjis-cp932/) {
  note "--- ",visq($alt_enc)," ---";
  my $new_path = "$tmpdir/using_${alt_enc}.odt";
  {
    # Encode content.xml differently
    my $alt_xmloctets = eval { MyXML::encode_xml($orig_xmltext, $alt_enc) };
    if ($@) { diag "$alt_enc does not work"; next }
    oops "not encoded??" if $alt_xmloctets =~ /\Q$teststring\E/;
    $alt_xmloctets =~ /$testoctets_re/
      or oops "can not find encoded octets";



( run in 0.595 second using v1.01-cache-2.11-cpan-131fc08a04b )