ruby-changes:7251
From: naruse <ko1@a...>
Date: Fri, 22 Aug 2008 12:32:36 +0900 (JST)
Subject: [ruby-changes:7251] Ruby:r18770 (trunk): * dir.c (dir_enc_str_new): set US-ASCII to the path
naruse 2008-08-22 12:32:13 +0900 (Fri, 22 Aug 2008) New Revision: 18770 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18770 Log: * 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. Modified files: trunk/ChangeLog trunk/dir.c Index: ChangeLog =================================================================== --- ChangeLog (revision 18769) +++ ChangeLog (revision 18770) @@ -1,3 +1,11 @@ +Fri Aug 22 11:36:31 2008 NARUSE, Yui <naruse@r...> + + * 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@r...> * dir.c (dir_enc_str_new): renamed from dir_enc_str. Index: dir.c =================================================================== --- dir.c (revision 18769) +++ dir.c (revision 18770) @@ -427,6 +427,9 @@ 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 @@ 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; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/