зеркало из https://github.com/github/ruby.git
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@18770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
cc17cad920
Коммит
3337c792e6
|
@ -1,3 +1,11 @@
|
||||||
|
Fri Aug 22 11:36:31 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
Fri Aug 22 11:30:38 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
Fri Aug 22 11:30:38 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* dir.c (dir_enc_str_new): renamed from dir_enc_str.
|
* dir.c (dir_enc_str_new): renamed from dir_enc_str.
|
||||||
|
|
4
dir.c
4
dir.c
|
@ -427,6 +427,9 @@ static VALUE
|
||||||
dir_enc_str_new(const char *p, long len, rb_encoding *enc)
|
dir_enc_str_new(const char *p, long len, rb_encoding *enc)
|
||||||
{
|
{
|
||||||
VALUE path = rb_tainted_str_new(p, len);
|
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);
|
rb_enc_associate(path, enc);
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
@ -1533,6 +1536,7 @@ push_glob(VALUE ary, VALUE str, int flags)
|
||||||
struct glob_args args;
|
struct glob_args args;
|
||||||
rb_encoding *enc = rb_enc_get(str);
|
rb_encoding *enc = rb_enc_get(str);
|
||||||
|
|
||||||
|
if (enc == rb_usascii_encoding()) enc = rb_filesystem_encoding();
|
||||||
args.func = push_pattern;
|
args.func = push_pattern;
|
||||||
args.value = ary;
|
args.value = ary;
|
||||||
args.enc = enc;
|
args.enc = enc;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче