diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-24 22:53:42 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-24 22:53:42 +0000 |
commit | 85738261a582ceef498b86b784171fba59bf60cc (patch) | |
tree | aa97e06f7c4474313689463864dcb672a3d93552 /error.c | |
parent | cc07e34bfcc9675924fd0546b46eb53c3d972ab8 (diff) | |
download | ruby-85738261a582ceef498b86b784171fba59bf60cc.tar.gz |
* dir.c (dir_initialize): keep path in original encoding.
* error.c (syserr_initialize): prefer the encoding of message over
locale. [ruby-dev:45279][Bug #6071]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -1212,15 +1212,13 @@ syserr_initialize(int argc, VALUE *argv, VALUE self) else err = "unknown error"; if (!NIL_P(mesg)) { rb_encoding *le = rb_locale_encoding(); - VALUE str = mesg; + VALUE str = StringValue(mesg); + rb_encoding *me = rb_enc_get(mesg); - StringValue(str); mesg = rb_sprintf("%s - %.*s", err, (int)RSTRING_LEN(str), RSTRING_PTR(str)); - if (le == rb_usascii_encoding()) { - rb_encoding *me = rb_enc_get(mesg); - if (le != me && rb_enc_asciicompat(me)) - le = me; + if (le != me && rb_enc_asciicompat(me)) { + le = me; }/* else assume err is non ASCII string. */ OBJ_INFECT(mesg, str); rb_enc_associate(mesg, le); |