Forum: Ruby bad interpreter and end of line characters

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Berger, Daniel (Guest)
on 2006-05-16 20:09
(Received via mailing list)
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.
ts (Guest)
on 2006-05-16 20:30
(Received via mailing list)
>>>>> "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
This topic is locked and can not be replied to.