script error when thru ssh only

U

Une Bévue

I have a script, say "my_script" returning an error :

/Users/yt/bin/scripts/recette_sources_list.rb:17:in `block in <main>':
invalid byte sequence in US-ASCII (ArgumentError)

stderr : from /Users/yt/bin/scripts/recette_sources_list.rb:16:in
`each_line'

stderr : from /Users/yt/bin/scripts/recette_sources_list.rb:16:in `<main>'

only when executed thru ssh by :

ssh server 'path/to/my_script'
or
ssh server '/path/to/ruby another_path/to/my_script'

no error at all if run directly on server.

the lines :
15 i=1
16 File.open(RECETTES_TOOLKIT).each_line do |line|
17 sources_lines[line.gsub(/^def doc_([a-zA-Z0-9_]+)\(which, html,
url\)$/, '\1').chomp]=i if line =~ /^def doc_/
18 i+=1
19 end

with "RECETTES_TOOLKIT" being another absolute path to another ruby script.
 
U

Une Bévue

Le 25/02/13 14:47, Une Bévue a écrit :
/Users/yt/bin/scripts/recette_sources_list.rb:17:in `block in <main>':
invalid byte sequence in US-ASCII (ArgumentError)

I've found a solution, following :
<http://www.ruby-forum.com/topic/178706>

then using one of:

File.open("....", :encoding => "UTF-8") # Use this encoding
File.open("....", :encoding => "ENV") # Follow the environment
File.open("....") # No idea, treat as binary
 

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

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top