Ecurb has asked for the wisdom of the Perl Monks concerning the following question:
According to notepad++ the IDrive log file was UCS-2 LE. Perl would not slurp the file into a string until I specifically used ":encoding(UCS-2LE)" and until I skipped past the first two bytes of the file. If I did not skip the first two byes I would get a "wide character warning" and "$lines = <LOGFILE>" would only capture a few characters out of a 1088 character file.my $logopen = open LOGFILE,"<:encoding(UCS-2LE)", $file; seek LOGFILE, 2, 0; local $/ = undef; my $lines = <LOGFILE>; print '<li>'; if ( $lines =~ /Backup Completed/ ) { print "IDrive Backup Completed: "; } else { print "<b>Backup FAILED:</b> "; } print $file . "</li>\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems Handling UCS-2LE
by ikegami (Patriarch) on May 21, 2009 at 18:35 UTC | |
by Ecurb (Initiate) on May 23, 2009 at 19:18 UTC | |
by ikegami (Patriarch) on May 25, 2009 at 17:24 UTC | |
by Ecurb (Initiate) on May 24, 2009 at 02:18 UTC | |
by ikegami (Patriarch) on May 25, 2009 at 17:38 UTC | |
by Ecurb (Initiate) on Jun 05, 2009 at 17:01 UTC |