summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-22 09:49:35 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-22 09:49:35 +0000
commita922df795b333a56bedfb0428348ed35f31720ca (patch)
tree2b290a9ebf499c8976f629e78fc811747ad1851a /vm_method.c
parent68a2b3cf7f4ba888501b760c26b6855bb9ad0092 (diff)
merges r23491 from trunk into ruby_1_9_1.
-- * vm_method.c (rb_attr): should preserve encoding info. [ruby-dev:38498] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@23536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/vm_method.c b/vm_method.c
index 774fa1eda9..19a8a3ebbb 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -432,6 +432,7 @@ rb_attr(VALUE klass, ID id, int read, int write, int ex)
{
const char *name;
ID attriv;
+ VALUE aname;
int noex;
if (!ex) {
@@ -459,7 +460,9 @@ rb_attr(VALUE klass, ID id, int read, int write, int ex)
if (!name) {
rb_raise(rb_eArgError, "argument needs to be symbol or string");
}
- attriv = rb_intern_str(rb_sprintf("@%s", name));
+ aname = rb_sprintf("@%s", name);
+ rb_enc_copy(aname, rb_id2str(id));
+ attriv = rb_intern_str(aname);
if (read) {
rb_add_method(klass, id, NEW_IVAR(attriv), noex);
}