Skip to content

Commit 124cb7f

Browse files
authored
Use str encoding for empty rest string (#79)
The empty string here should match the encoding of the scanner string. Fixes #78
1 parent d6f97ec commit 124cb7f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/jruby/org/jruby/ext/strscan/RubyStringScanner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ public IRubyObject rest(ThreadContext context) {
770770
int realSize = value.getRealSize();
771771

772772
if (curr >= realSize) {
773-
return RubyString.newEmptyString(runtime);
773+
return RubyString.newEmptyString(runtime, str.getEncoding());
774774
}
775775

776776
return extractRange(runtime, curr, realSize);

0 commit comments

Comments
 (0)