From: Jarkko Hietaniemi Date: Sun, 7 Apr 2002 14:51:04 +0000 (+0000) Subject: Duh. If the input is a stream of UTF-8 bytes, all that's X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=735b7a62d039909fa334af8e05d4788f54c2c65a;p=p5sagit%2Fp5-mst-13.2.git Duh. If the input is a stream of UTF-8 bytes, all that's needed is SvUTF8_on(), sv_utf8_upgrade() is quite bogus. Now, where was my coffee mug... p4raw-id: //depot/perl@15779 --- diff --git a/ext/File/Glob/Glob.pm b/ext/File/Glob/Glob.pm index 4c34d38..1ae894f 100644 --- a/ext/File/Glob/Glob.pm +++ b/ext/File/Glob/Glob.pm @@ -338,7 +338,6 @@ Unicode compatibility: The filenames returned will be marked as being in UTF-8 encoding of Unicode. Note that it is your responsibility to ascertain that the filesystem you are globbing in returns valid UTF-8 filenames. -The encoding pragma affects this feature, see L. =head1 DIAGNOSTICS diff --git a/ext/File/Glob/Glob.xs b/ext/File/Glob/Glob.xs index 5d95666..1bb5fc4 100644 --- a/ext/File/Glob/Glob.xs +++ b/ext/File/Glob/Glob.xs @@ -63,8 +63,8 @@ PPCODE: strlen(pglob.gl_pathv[i]))); TAINT; SvTAINT(tmp); - if (pglob.gl_flags & GLOB_UTF8) - sv_utf8_upgrade(tmp); + if (pglob.gl_flags & GLOB_UTF8 && !IN_BYTES) + SvUTF8_on(tmp); PUSHs(tmp); } diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index c04cc48..048ecfb 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -3035,7 +3035,6 @@ DIRHANDLEs have their own namespace separate from FILEHANDLEs. In three-argument form the middle argument may be C<:utf8> to force the filenames returned by readdir() to be in UTF-8 encoding of Unicode. This naturally works only if your filesystem returns UTF-8 filenames. -The encoding pragma affects this feature, see L. =item ord EXPR diff --git a/pp_sys.c b/pp_sys.c index ea9a6a5..aa8fb77 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -3817,8 +3817,8 @@ PP(pp_readdir) if (!(IoFLAGS(io) & IOf_UNTAINT)) SvTAINTED_on(sv); #endif - if (IoFLAGS(io) & IOf_DIR_UTF8) - sv_utf8_upgrade(sv); + if (IoFLAGS(io) & IOf_DIR_UTF8 && !IN_BYTES) + SvUTF8_on(sv); XPUSHs(sv_2mortal(sv)); } }