Permalink
Browse files

Fix #1222, StringIO.gets w/ utf8

  • Loading branch information...
1 parent a054e67 commit e6e41f947fe5a1df709657b433587a2ee5b519fe @dragonsinth dragonsinth committed with enebo Dec 4, 2013
Showing with 8 additions and 1 deletion.
  1. +1 −1 core/src/main/java/org/jruby/ext/stringio/StringIO.java
  2. +7 −0 test/test_io.rb
@@ -435,7 +435,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;
}
View
@@ -575,4 +575,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 e6e41f9

Please sign in to comment.