Problems reading a text file with unusual encoding

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!

Hi,

2009/7/22 Randy G. [email protected]:

input = File.readlines(‘output.txt’)
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 H.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs