# The encoding of StringIO.new

**URL:** <https://www.ruby-forum.com/t/the-encoding-of-stringio-new/126337>\
**Category:** Development\
**Created:** [January 17, 2008, 3:18pm UTC](https://www.ruby-forum.com/t/the-encoding-of-stringio-new/126337 "2008-01-17T15:18:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sheepman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepman](https://www.ruby-forum.com/u/sheepman)\
**Post date:** [January 17, 2008, 3:18pm UTC](https://www.ruby-forum.com/t/the-encoding-of-stringio-new/126337/1 "2008-01-17T15:18:02Z")

</div>

e$B$3$s$P$s$Oe(B sheepman e$B$G$9!#e(B

e$B%9%/%j%W%H$G07$&J8;zNs$N%(%s%3!\<%G%#%s%0$Oe(B default\_external  
e$B$r2\>Dj$9$k$3$H$,e(B  
e$BB?$$$G$7$g$&!#$J$N$G0z?t$J$7$Ne(B StringIO.new  
e$B$,JV$9J8;zNs$N%(%s%3!\<%G%#%s%0$be(B  
Encoding.default\_external e$B$@$H$&$l$7$$$s$G$9$,!"$I$&$G$7$g$&e(B?

# Index: ext/stringio/stringio.c

— ext/stringio/stringio.c (revision 15080)  
+++ ext/stringio/stringio.c (working copy)  
@@ -187,7 +187,7 @@ strio\_init(int argc, VALUE \*argv, struct  
ptr-\>flags = OBJ\_FROZEN(string) ? FMODE\_READABLE :  
FMODE\_READWRITE;  
break;  
case 0:

- 

```
  string = rb_str_new("", 0);

```

- 

```
  string = rb_enc_str_new("", 0, rb_default_external_encoding());
  ptr->flags = FMODE_READWRITE;
  break;

```

}
