Hello Monks,
I have a strange issue. I'm reading what appears to be a normal text file written by a blackberry server.
When i load in the first line of the log file that defines its columns it appears in memmory in the komodo debugger and in print statements as:
"ÿþ"\x00N\x00a\x00m\x00e\x00.\x00I\x00D\x00"\x00,\x00"\x00P\x00I\x00N\ +x00"\x00,\x00"\x00E\x00m\x00a\x00i\x00l\x00 \x00A\x00d\x00d\x00r\x00e +\x00s\x00s\x00"\x00,\x00"\x00T\x00y\x00p\x00e\x00 \x00o\x00f\x00 \x00 +M\x00e\x00s\x00s\x00a\x00g\x00e\x00"\x00,\x00"\x00T\x00o\x00"\x00,\x0 +0"\x00C\x00c\x00"\x00,\x00"\x00B\x00c\x00c\x00"\x00,\x00"\x00F\x00r\x +00o\x00m\x00"\x00,\x00"\x00S\x00u\x00b\x00j\x00e\x00c\x00t\x00"\x00,\ +x00"\x00B\x00o\x00d\x00y\x00"\x00,\x00"\x00S\x00e\x00n\x00d\x00/\x00R +\x00e\x00c\x00e\x00i\x00v\x00e\x00d\x00 \x00D\x00a\x00t\x00e\x00"\x00 +,\x00"\x00S\x00e\x00r\x00v\x00e\x00r\x00 \x00L\x00o\x00g\x00 \x00D\x0 +0a\x00t\x00e\x00"\x00,\x00"\x00O\x00v\x00e\x00r\x00a\x00l\x00l\x00 \x +00M\x00e\x00s\x00s\x00a\x00g\x00e\x00 \x00S\x00t\x00a\x00t\x00u\x00s\ +x00"\x00,\x00"\x00C\x00o\x00m\x00m\x00a\x00n\x00d\x00"\x00,\x00"\x00U +\x00I\x00D\x00"\x00" <br><br> for any match that i do and any print that i do.
However, if i run split and print it out i get:
"Name.ID","PIN","Email Address","Type of Message","To","Cc","Bcc","Fro +m","Subject","Body","Send/Received Date","Server Log Date","Overall M +essage Status","Command","UID"
What is going on here? I need to do a regex match and print the string normally.
open FILE, "<", $file or die "open: $!"; while (<FILE>) { my $line2 = $_; chomp $line2; my @line = split (/","/,$line2); if ( $line[0] =~ m/Name.ID/) { print "here \n"; next; } else { print "$line[0] \n"; } print "$line[0],$line[1],$line[2],$line[3],$line[4],$line[ +5],$line[6],$line[7],$line[8],$line[9],$line[10],$line[11],$line[12], +$line[13],$line[14]"; } } }

result:
ÿþ" "Name.ID","PIN","Email Address","Type of Message","To","Cc","Bcc","Fro +m","Subject","Body","Send/Received Date","Server Log Date","Overall M +essage Status","Command","UID"&#11308;&#11308;&#11308;&#11308;&#11308 +;&#11308;&#11308;
Dave -- Saving the world one node at a time

In reply to Dealing with strange data encoding issue by Zapawork

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.