darrent has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I've got a noddy script that opens a file and proceses a line at a time, regular expressions are used to check the data read in. The problem is that none of my regular expressions work on a particular file that is generated on Windows 2000, but processed on Windows NT. I thought the problem would be that the Windows 2000 file was uni-code, so I tried "use utf8;" and "$line =~ tr/\0-x{ff}//UC;" without success. An example line (examined using the debugger) looks like:

x $line

0 " ¦B\c@a\c@c\c@k\c@u\c@p\c@ \c@o\c@f\c@ \c@\"\c@C\c@\$\c@\"\c@\cM\c@"

Any help would be great.

Cheers, Darren.

  • Comment on Processing ascii from Win2000 file stuffs up my reg ex's

Replies are listed 'Best First'.
Re: Processing ascii from Win2000 file stuffs up my reg ex's
by particle (Vicar) on Feb 07, 2002 at 16:37 UTC
    what are your regexes? it's a little hard to debug without them.

    ~Particle

      Sorted:

      use Unicode::String;

      $win2klog = utf16($line);

      if ( lc($win2klog->latin1) =~ /backup status/i)

      Cheers, Darren