Skip to content


Fix #2528. RegexpError: invalid multibyte character
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed Feb 16, 2015
1 parent 1c0f056 commit 258be73
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions core/src/main/java/org/jruby/
Original file line number Diff line number Diff line change
Expand Up @@ -3093,18 +3093,10 @@ private IRubyObject gsubCommon19(ThreadContext context, Block block, RubyString
private IRubyObject gsubCommon19(ThreadContext context, Block block, RubyString repl,
RubyHash hash, IRubyObject arg0, final boolean bang, int tuFlags, boolean useBackref) {
Ruby runtime = context.runtime;

final Regex pattern, prepared;
final RubyRegexp regexp;
if (arg0 instanceof RubyRegexp) {
regexp = (RubyRegexp)arg0;
pattern = regexp.getPattern();
prepared = regexp.preparePattern(this);
} else {
regexp = null;
pattern = getStringPattern19(runtime, arg0);
prepared = RubyRegexp.preparePattern(runtime, pattern, this);
RubyRegexp regexp = arg0 instanceof RubyRegexp ? (RubyRegexp) arg0 :
RubyRegexp.newRegexp(runtime, RubyRegexp.quote19(getStringForPattern(arg0).getByteList(), false), new RegexpOptions());
Regex pattern = regexp.getPattern();
Regex prepared = regexp.preparePattern(this);

final int begin = value.getBegin();
int slen = value.getRealSize();
Expand Down

0 comments on commit 258be73

Please sign in to comment.