H
Henry Lenzi
Hi All --
I have some questions related to text compression and fonts.
If I use a shell, like this
$ gzip < f1.txt > TEST1
and the read the file
$ cat TEST1
It apears like this (ANSI extended charset -hope you can see this):
;Â0D??åð?(?HV,ëàQ*DAqÿSôæÍ\±Ì1|"ßs
AT=yy?¸Ô|Á;®e©¨ÂèØ®°\ æÝTÏ*¹µ¨¯fÊÑhFÖŻܡR$ÚºïÛY½=ãå9ñöa»Û¯«+R %(Óc NEzýmUl ~{EöÎýñ§É$
Great! I wanted that! But if I try to use zip with perl:
#!/usr/bin/perl
use warnings;
use strict;
my $source = shift @ARGV;
#my $destination = shift @ARGV;
open IN, $source;
#open OUT, "|gzip > $destination";
open OUT, "|gzip > ./TEST";
close IN;
close OUT;
then I can't cat the file. Nothing appears, because it's compressed.
I can do it with the shell, but can't do with perl.
Why is that? What must I do?
2) Regarding the compressed string:
;Â0D??åð?(?HV,ëàQ*DAqÿSôæÍ\±Ì1|"ßs
AT=yy?¸Ô|Á;®e©¨ÂèØ®°\ æÝTÏ*¹µ¨¯fÊÑhFÖŻܡR$ÚºïÛY½=ãå9ñöa»Û¯«+R %(Óc NEzýmUl ~{EöÎýñ§É$
Is there a way to read it and obtain the ANSI extended charset hexadecimal _numbers_?
For instance, the above line would display:
3B C2 4F etc...
I have attempted this:
#!/usr/bin/perl
use warnings;
use strict;
use utf8;
my $source = shift @ARGV;
my $destination = shift @ARGV;
open (IN, "< $source");
my @array = unpack("C*", $source);
print "@array,\n";
close IN;
but the result is that it won't read the _content_ of the file.
$ perl prog.pl TEST1
84 69 83 84 49,
What is the issue here?
Any help is greatly appreciated.
Henry
I have some questions related to text compression and fonts.
If I use a shell, like this
$ gzip < f1.txt > TEST1
and the read the file
$ cat TEST1
It apears like this (ANSI extended charset -hope you can see this):
;Â0D??åð?(?HV,ëàQ*DAqÿSôæÍ\±Ì1|"ßs
AT=yy?¸Ô|Á;®e©¨ÂèØ®°\ æÝTÏ*¹µ¨¯fÊÑhFÖŻܡR$ÚºïÛY½=ãå9ñöa»Û¯«+R %(Óc NEzýmUl ~{EöÎýñ§É$
Great! I wanted that! But if I try to use zip with perl:
#!/usr/bin/perl
use warnings;
use strict;
my $source = shift @ARGV;
#my $destination = shift @ARGV;
open IN, $source;
#open OUT, "|gzip > $destination";
open OUT, "|gzip > ./TEST";
close IN;
close OUT;
then I can't cat the file. Nothing appears, because it's compressed.
I can do it with the shell, but can't do with perl.
Why is that? What must I do?
2) Regarding the compressed string:
;Â0D??åð?(?HV,ëàQ*DAqÿSôæÍ\±Ì1|"ßs
AT=yy?¸Ô|Á;®e©¨ÂèØ®°\ æÝTÏ*¹µ¨¯fÊÑhFÖŻܡR$ÚºïÛY½=ãå9ñöa»Û¯«+R %(Óc NEzýmUl ~{EöÎýñ§É$
Is there a way to read it and obtain the ANSI extended charset hexadecimal _numbers_?
For instance, the above line would display:
3B C2 4F etc...
I have attempted this:
#!/usr/bin/perl
use warnings;
use strict;
use utf8;
my $source = shift @ARGV;
my $destination = shift @ARGV;
open (IN, "< $source");
my @array = unpack("C*", $source);
print "@array,\n";
close IN;
but the result is that it won't read the _content_ of the file.
$ perl prog.pl TEST1
84 69 83 84 49,
What is the issue here?
Any help is greatly appreciated.
Henry