summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-23 19:29:01 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-23 19:29:01 +0000
commit06d87bfeac364cc77f3ef09a477aa12957a51f0f (patch)
tree8a3ef3b33264ca16fd9ce937f78218f8a97570a1
parent1ed3297c8fb704fd0d71ddedb22eb1a823291e2d (diff)
downloadruby-06d87bfeac364cc77f3ef09a477aa12957a51f0f.tar.gz
ruby-06d87bfeac364cc77f3ef09a477aa12957a51f0f.tar.xz
ruby-06d87bfeac364cc77f3ef09a477aa12957a51f0f.zip
* io.c (io_enc_str): should preserve default_external encoding.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog2
-rw-r--r--io.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 940d93359..4339904cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,8 @@ Mon Dec 24 02:59:32 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (str_new_shared): was setting embedding flag of wrong
string object. [ruby-dev:32685]
+ * io.c (io_enc_str): should preserve default_external encoding.
+
Mon Dec 24 02:06:35 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (rb_f_open): documentation update.
diff --git a/io.c b/io.c
index 3dda55cdc..54bff0ecb 100644
--- a/io.c
+++ b/io.c
@@ -1316,9 +1316,9 @@ io_enc_str(VALUE str, rb_io_t *fptr)
rb_enc_from_encoding(fptr->enc),
rb_enc_from_encoding(fptr->enc2));
}
- else if (fptr->enc) {
+ else {
/* just one encoding, so associate it with the string */
- rb_enc_associate(str, fptr->enc);
+ rb_enc_associate(str, io_read_encoding(fptr));
}
return str;
}