File reading problems in Windows

Hi, I’m having some problems reading a file in Windows. The file is
encoded in CP850.

The original file has the following text:

Serial Number: 4006940900338

When reading in Windows I got the following output:

S e r i a l N u m b e r : 4 0 0 6 9 4 0 9 0 0 3 3 8

It puts lots of space in it.

When reading in Ubuntu I got the normal output

I have tried lots of different options to have the same behaviour in
Windows and Linux without luck.

The code I was using:

puts IO.read(“test.txt”)

then tried

puts IO.read(“test.txt”, :encoding => ‘cp850’)

Not sure what to do… any help: thanks a lot!

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