Problems reading a text file with unusual encoding

R

Randy General

I have a pcap file that I simply changed the file extension to text on.
It can be seen here:

http://69.4.224.185/output.txt

When I try to load the file into Ruby, some parts of it come out, while
others don't.

For example:

input = File.readlines('output.txt')

input = input.to_s

proof = input.scan(/challenge/)

proof => challenge

Challenge is written in the file and it can be scanned for
appropriately. However, other normally written words (there's a line
that says bdticket later on) can not be parsed. I realize this isn't the
most elegant way of going about this, but this is the only format I can
get this file in, and if I open the file in notepad I can see the
following:

bdTicket\WQmS/

But when I scan for bdTicket, nothing comes up.

Anyone have any ideas how I can get around this?

Any help is appreciated!
 
H

Heesob Park

Hi,

2009/7/22 Randy General said:
I have a pcap file that I simply changed the file extension to text on.
It can be seen here:

http://69.4.224.185/output.txt

When I try to load the file into Ruby, some parts of it come out, while
others don't.

For example:

input = File.readlines('output.txt')

input = input.to_s

proof = input.scan(/challenge/)

proof => challenge

Challenge is written in the file and it can be scanned for
appropriately. However, other normally written words (there's a line
that says bdticket later on) can not be parsed. I realize this isn't the
most elegant way of going about this, but this is the only format I can
get this file in, and if I open the file in notepad I can see the
following:

bdTicket\WQmS/

But when I scan for bdTicket, nothing comes up.

Anyone have any ideas how I can get around this?

Any help is appreciated!

I guess your OS is Windows.

Try
input = File.open('output.txt','rb').readlines
instead of
input = File.readlines('output.txt')

Regards,

Park Heesob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,170
Messages
2,570,925
Members
47,468
Latest member
Fannie44U3

Latest Threads

Top