Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1300 from dragonsinth/scottb/1222

Fix #1222, StringIO.gets w/ utf8
  • Loading branch information...
commit 7fa78419b322929aacd40550fc1b0626a9ede0f2 2 parents 1dbbf16 + 1ab5c65
@enebo enebo authored
View
2  core/src/main/java/org/jruby/ext/stringio/StringIO.java
@@ -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;
}
View
7 test/test_io.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.