×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Spaces are being added between all characters

Spaces are being added between all characters

Spaces are being added between all characters

(OP)
I'm looking for assistance with an issue I'm having on this log file. Basically all I'm trying to do is open a file and save it into an array for searching. On a small test.txt file that I created with a few lines, it does this no problem and prints elements of the array without issues. I have a log file that is much larger that I wanted to use for testing and practice, but every time I load it into the array the same way as the sample text file, for some reason it gets a space added between every character. Can you point me in the right direction of why?

CODE --> Perl

use feature ':5.10';

my $file = <STDIN>;

open (FH, $file);
my @raw = <FH>;
close (FH);

print $raw[0];

Here is the original line in the file:

CODE -->

=== Verbose logging started: 5/1/2012 3:00:40 Build type: SHIP UNICODE 3.01.4001.5512 Calling process: c:\96a3e4c72f1c1c4b5d35fb9c55a993\x86\Setup.exe ===

Here is the output once it's been loaded to the array and printed as $raw[0]:

CODE -->

■= = = V e r b o s e l o g g i n g s t a r t e d : 5 / 1 / 2 0 1 2
3 : 0 0 : 4 0 B u i l d t y p e : S H I P U N I C O D E 3 . 0 1 . 4
0 0 1 . 5 5 1 2 C a l l i n g p r o c e s s : c : \ 9 6 a 3 e 4 c 7 2 f
c 1 c 4 b 5 d 3 5 f b 9 c 5 5 a 9 9 3 \ x 8 6 \ S e t u p . e x e = = =

As you can see, there is an additional space between EVERY character... I have no clue why. It also appears in the command window like every character is in it's unique column. So looking back through the code everything lines up so that all visible characters are in the same lines. The 'spaced columns' have no characters in them.

Thanks in advance!

RE: Spaces are being added between all characters

(OP)
Ok, nevermind. I figured out what my problem was.

The file had been saved as a ANSI when it contained Unicode characters. Resaved the file as UTF-8 Encoding and resolved my issue.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close