Perl File handling issue how to handle differnet character set
I have file which has the following content when i open the file with notepad. This file is in UCS-16 format. Howevever when I open this file with perl open (FILE,"c:\\file.txt") & read it into an array The array contains something else..(see below output when while read into an array) Basically I want to look for a text in this file but since file is encoded in UCS-16 format. i cannot do a string comparison.
ANY WAY in perl how to handle this .... Iam really not sure.... I'am able to view file with notepad .. but with perl open command output is really different.
#************* File when opened with notepad **************
L o a d e d s i g n a t u r e s : 4 5 0 0 8 1
S c a n n i n g f i l e C : \ v a u l t \ e i c a r c o m 2 . z i p
S c a n n i n g f i l e C : \ v a u l t \ e i c a r c o m 2 . z i p . c h k s u m
C : \ v a u l t \ e i c a r c o m 2 . z i p : : E i c a r - T e s t - S i g n a t u r e
Time taken in msecs: 1000
#************************content when opened with PERL OPEN Command
L\x00o\x00a\x00d\x00e\x00d\x00 \x00s\x00i\x00g\x00n\x00a\x00t\x00u\x00r\x00e\x00s\x00:\x00 \x004\x005\x000\x000\x008\x001\x00
\x00
S\x00c\x00a\x00n\x00n\x00i\x00n\x00g\x00 \x00f\x00i\x00l\x00e\x00 \x00C\x00:\x00\\x00v\x00a\x00u\x00l\x00t\x00\\x00e\x00i\x00c\x00a\x00r\x00c\x00o\x00m\x002\x00.\x00z \x00i\x00p\x00
\x00S\x00c\x00a\x00n\x00n\x00i\x00n\x00g\x00 \x00f\x00i\x00l\x00e\x00 \x00C\x00:\x00\\x00v\x00a\x00u\x00l\x00t\x00\\x00e\x00i\x00c\x00a\x00r\x00c\x00o\x00m\x002\x00.\x00z \x00i\x00p\x00.\x00c\x00h\x00k\x00s\x00u\x00m\x00
\x00C\x00S\x00A\x00C\x00L\x00A\x00M\x00U\x00T\x00I\x00L\x00:\x00C\x00:\x00\\x00v\x00a\x00u\x00l\x00t \x00\\x00e\x00i\x00c\x00a\x00r\x00c\x00o\x00m\x002\x00.\x00z\x00i\x00p\x00:\x00:\x00E\x00i\x00c\x00a \x00r\x00-\x00T\x00e\x00s\x00t\x00-\x00S\x00i\x00g\x00n\x00a\x00t\x00u\x00r\x00e\x00
\x00
Time taken in msecs: 1000
Last edited by alix123; 10-27-2008 at 06:20 AM.
|