Bad interpreter and end of line characters


#1

Hi all,

Check it:

test1.rb - created via Eclipse on Windows, using UTF8 encoding

#!/usr/bin/ruby

test2.rb - created via vi on Linux

#!/usr/bin/ruby

./test1.rb
: bad interpreter: No such file or directory

./test2.rb

Hey! WTF?

od test1.rb
0000000 020443 072457 071163 061057 067151 071057 061165 006571
0000020 000012
0000021

od test2.rb
0000000 020443 072457 071163 061057 067151 071057 061165 005171
0000020

Normally I can see newlines as ^M characters with vi, but I don’t see
them, and attempting to replace them doesn’t work.

According to my ASCII chart, 12 is a newline. Ok, I wrote test1.rb on
Windows. But where the heck is that 21 (device control 1?) coming from?
Is it the UTF8 encoding? And how do I get rid of it? And why is it
making Ruby choke?

Thanks,

Dan

This communication is the property of Qwest and may contain confidential
or
privileged information. Unauthorized use of this communication is
strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and
destroy
all copies of the communication and any attachments.


#2

“B” == Berger, Daniel removed_email_address@domain.invalid writes:

od test1.rb
B> 0000000 020443 072457 071163 061057 067151 071057 061165 006571
B> 0000020 000012
B> 0000021

Try

cat -v test1.rb

or

od -b test1.rb

B> Is it the UTF8 encoding? And how do I get rid of it? And why is it

ruby -pi.bak -e ‘$_.sub!(/\cM$/, “”)’

Guy Decoux