NARUSE, Yui wrote: > This is spec. STDIN encoding will be locale when no magic comment and > -K and -E. Thank you for the table. This makes a lot of sense. What doesn't make sense to me is that I can read invalid strings: irb(main):017:0> File.open('/tmp/foo', 'w') { |f| f.puts "\x81" } => nil irb(main):018:0> s = File.open('/tmp/foo') { |f| f.gets } => "\x81\n" irb(main):019:0> s.encoding => #<Encoding:US-ASCII> irb(main):020:0> "\x81" =~ /foo/ => nil irb(main):021:0> s =~ /foo/ ArgumentError: broken US-ASCII string from (irb):21 from /usr/local/lib/ruby/1.9.0/irb.rb:149:in `block (2 levels) in eval_input' from /usr/local/lib/ruby/1.9.0/irb.rb:262:in `signal_status' from /usr/local/lib/ruby/1.9.0/irb.rb:146:in `block in eval_input' from /usr/local/lib/ruby/1.9.0/irb.rb:145:in `eval_input' from /usr/local/lib/ruby/1.9.0/irb.rb:69:in `block in start' from /usr/local/lib/ruby/1.9.0/irb.rb:68:in `catch' from /usr/local/lib/ruby/1.9.0/irb.rb:68:in `start' from /usr/local/bin/irb-1.9:12:in `<main>' Is this behavior also intended? Can/should I change the locale/encoding of my input streams? Paul