A raw stream of the printable text in a WordStar
file could therefore be discerned by masking off
the 8th bit and discarding codes in the range of
00h through 1Fh.
This method would, of course, omit all formatting
and control information in the file. In addition
to stripping control characters, symmetrical
sequences must be stripped.
See the description of symmetrical sequences below.
I would try the following to remove control codes:
$/ = undef;
open FH, "< $wordstarfile" or die "craps. $!";
$doc = <FH>;
# delete all ctrl chars except newline
$doc =~ tr/\x00-\x09\x0b-\x1f//d;
# turn off all high bits
$doc =~ s/([\xa0-\xff])/chr(ord($1) ^ 0x80)/eg;
print $doc;
This would toss out all your control characters and formatting sequences, so you'd probably want to see what your results look like, then dive into the format document and start figuring out how much of the original formatting you want to preserve.
|