summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parse.y1
-rw-r--r--test/ruby/test_parse.rb8
2 files changed, 9 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index e24d26e6e1..909a4ec3b1 100644
--- a/parse.y
+++ b/parse.y
@@ -8274,6 +8274,7 @@ set_file_encoding(struct parser_params *p, const char *str, const char *send)
continue;
}
if (STRNCASECMP(str-6, "coding", 6) == 0) break;
+ sep = 0;
}
for (;;) {
do {
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index 3f2deabedd..493042ef67 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -692,6 +692,14 @@ x = __ENCODING__
x = __ENCODING__
END
end
+
+ assert_nothing_raised do
+ eval <<-END, nil, __FILE__, __LINE__+1
+# xxxx : coding sjis
+x = __ENCODING__
+ END
+ end
+ assert_equal(__ENCODING__, x)
end
def test_utf8_bom