Skip to content

Commit

Permalink
Fix #1222, StringIO.gets w/ utf8
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonsinth committed Dec 4, 2013
1 parent f4fc345 commit 1ab5c65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ext/stringio/StringIO.java
Expand Up @@ -433,7 +433,7 @@ private static int bm_search(byte[] little, int lstart, int llen, byte[] big, in
j--;
}
if (j < 0) return k + 1;
i += skip[big[i + bstart]];
i += skip[big[i + bstart] & 0xFF];
}
return -1;
}
Expand Down
7 changes: 7 additions & 0 deletions test/test_io.rb
Expand Up @@ -540,4 +540,11 @@ def test_rubyio_fileno_mapping_leak
closed_io_count = JRuby.runtime.fileno_int_map_size
assert_equal(starting_count, closed_io_count)
end

# JRUBY-1222
def test_stringio_gets_utf8
@stringio = StringIO.new(\r\n®\r\n")
assert_equal \r\n", @stringio.gets("\r\n")
assert_equal \r\n", @stringio.gets("\r\n")
end
end

0 comments on commit 1ab5c65

Please sign in to comment.