Re: Script OK on RO... but fails on PC nsPerl
[email protected] (Richard Proctor) Sat, 6 Jul 2002 08:47:00 +0100 (BST)
| Newsgroups | perl.riscos |
|---|---|
| Message-ID | <[email protected]> |
On Fri 05 Jul, Philip Perry wrote:
> Hello All,
>
> I'm having a problem with processing an Windows Outlook Express '.dbx'
> file.
>
> The script I've written to cut down the file to plain text works a treat
> on the RISC OS port of Perl5.... but when I run it on the nsPerl port
> installed on my friends PC it appears to choke on bytes containing the
> value 0x1A. If these bytes are removed in a text editor, all then goes
> well on the PC.
>
The problems is with windows treating text and binary files differently.
If you make the input Binary then it will work.
>
> #!perl -w
>
> open INFILE, "<emails.dbx" or die "Cannot read input file: $!";
binmode INFILE;
> open OUTFILE, ">filtrd.txt" or die "Cannot create output file: $!";
>
> while (<INFILE>) {
> s/.....\002\000\000........//g;
> s/[^ -~]+//g;
> print OUTFILE "$_\n";
> }
>
> close INFILE;
> close OUTFILE;
>
>
>
Richard
--
Personal [email protected] http://www.waveney.org
Telecoms [email protected] http://www.WaveneyConsulting.com
Web services [email protected] http://www.wavwebs.com
Independent Telecommunications Consultant, ATM expert, Web Analyst & Services