Skip to content

Commit 247bdd0

Browse files
committed
Update Java version to not set encoding on underlying string
1 parent 7a4d09a commit 247bdd0

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

ext/java/org/jruby/ext/stringio/StringIO.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,6 @@ public IRubyObject initialize_copy(ThreadContext context, IRubyObject other) {
421421
public IRubyObject binmode(ThreadContext context) {
422422
StringIOData ptr = this.getPtr();
423423
ptr.enc = EncodingUtils.ascii8bitEncoding(context.runtime);
424-
if (writable()) ptr.string.setEncoding(ptr.enc);
425424

426425
return this;
427426
}
@@ -1809,10 +1808,6 @@ public IRubyObject set_encoding(ThreadContext context, IRubyObject ext_enc) {
18091808

18101809
// in read-only mode, StringIO#set_encoding no longer sets the encoding
18111810
RubyString string = ptr.string;
1812-
if (string != null && writable() && string.getEncoding() != enc) {
1813-
string.modify();
1814-
string.setEncoding(enc);
1815-
}
18161811
} finally {
18171812
if (locked) unlock(ptr);
18181813
}
@@ -1847,9 +1842,6 @@ public IRubyObject set_encoding_by_bom(ThreadContext context) {
18471842
private Encoding setEncodingByBOM(ThreadContext context, StringIOData ptr) {
18481843
Encoding enc = detectBOM(context, ptr.string, (ctx, enc2, bomlen) -> {
18491844
ptr.pos = bomlen;
1850-
if (writable()) {
1851-
ptr.string.setEncoding(enc2);
1852-
}
18531845
return enc2;
18541846
});
18551847
ptr.enc = enc;

0 commit comments

Comments
 (0)