From 321539774a067beca19988c64a34a4d843ad845d Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 14 May 2009 01:17:49 +0000 Subject: * sample/test.rb (valid_syntax?): defaults to us-ascii. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sample/test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sample') diff --git a/sample/test.rb b/sample/test.rb index 03ab435e0..b0475c89f 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -1,4 +1,5 @@ #! /usr/bin/env ruby +# -*- coding: us-ascii -*- $testnum=0 $ntest=0 @@ -1932,7 +1933,7 @@ def valid_syntax?(code, fname) code.force_encoding("ascii-8bit") code = code.sub(/\A(?:\s*\#.*$)*(\n)?/n) { "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ok}\n" - } + }.force_encoding("us-ascii") catch {|tag| eval(code, binding, fname, 0)} rescue Exception STDERR.puts $!.message -- cgit