Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize for EBCDIC #32

Merged
merged 2 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/IO/Uncompress/Bunzip2.pm
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ sub chkTrailer
sub isBzip2Magic
{
my $buffer = shift ;
return $buffer =~ /^BZh\d$/;

# ASCII: B Z h 0 9
return $buffer =~ qr/^\x42\x5A\x68[\x30-\x39]$/;
}

1 ;
Expand Down
14 changes: 12 additions & 2 deletions t/105oneshot-zip-only.t
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,17 @@ for my $stream (0, 1)
}
}

{
my $ebcdic_skip_msg = "Input file is in an alien character set";

SKIP: {
skip $ebcdic_skip_msg, 3 if ord "A" != 65;

title "Regression: ods streaming issue";

# To execute this test on a non-ASCII machine, we could open the zip file
# without using the Name parameter, or xlate the parameter to ASCII, and
# also xlate the contents to native.

# The file before meta.xml in test.ods is content.xml.
# Issue was triggered because content.xml was stored
# as streamed and the code to walk the compressed streaming
Expand All @@ -323,7 +331,9 @@ for my $stream (0, 1)

}

{
SKIP: {
skip $ebcdic_skip_msg, 3 if ord "A" != 65;

title "Regression: odt non-streaming issue";
# https://github.com/pmqs/IO-Compress/issues/13

Expand Down
8 changes: 5 additions & 3 deletions t/112utf8-zip.t
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ BEGIN {
plan skip_all => "Encode is not available"
if $@ ;

plan skip_all => "Encode not woking in perl $]"
plan skip_all => "Encode not working in perl $]"
if $] >= 5.008 && $] < 5.008004 ;

# use Test::NoWarnings, if available
Expand Down Expand Up @@ -190,11 +190,13 @@ BEGIN {
ok $u->getHeaderInfo()->{Name} eq $name, "got bad filename";
}

{
SKIP: {
title "unzip: EFS => 1 filename not valid utf8 - language encoding flag set";

# The name hard-coded into this pre-built file is not illegal UTF-EBCDIC
skip "ASCII-centric test", 1, unless ord "A" == 65;

my $filename = "t/files/bad-efs.zip" ;
my $name = "\xF0\xA4\xAD";

eval { my $u = IO::Uncompress::Unzip->new( $filename, efs => 1 )
or die "Cannot open $filename: $UnzipError" };
Expand Down