diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-22 03:32:13 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-22 03:32:13 +0000 |
commit | a3992d65fb3597fd34f7eaed6ea18a4c140d3850 (patch) | |
tree | eb0fa6bc8acf46f999719eb10904f8b7828daf23 /dir.c | |
parent | 0fd5de0af3ecc47289005b204336cb789df922aa (diff) | |
download | ruby-a3992d65fb3597fd34f7eaed6ea18a4c140d3850.tar.gz ruby-a3992d65fb3597fd34f7eaed6ea18a4c140d3850.tar.xz ruby-a3992d65fb3597fd34f7eaed6ea18a4c140d3850.zip |
* dir.c (dir_enc_str_new): set US-ASCII to the path
when the path is 7bit string and encoding is ASCII compatible.
* dir.c (push_glob): set file system encoding when argument encoding
is US-ASCII.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -427,6 +427,9 @@ static VALUE dir_enc_str_new(const char *p, long len, rb_encoding *enc) { VALUE path = rb_tainted_str_new(p, len); + if (rb_enc_asciicompat(enc) && rb_enc_str_asciionly_p(path)) { + enc = rb_usascii_encoding(); + } rb_enc_associate(path, enc); return path; } @@ -1533,6 +1536,7 @@ push_glob(VALUE ary, VALUE str, int flags) struct glob_args args; rb_encoding *enc = rb_enc_get(str); + if (enc == rb_usascii_encoding()) enc = rb_filesystem_encoding(); args.func = push_pattern; args.value = ary; args.enc = enc; |