From: Jarkko Hietaniemi Date: Tue, 11 Jun 2002 03:21:53 +0000 (+0000) Subject: Make UTF-8 locales effective only if PerlIO has been X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ec71e7703a2a0c5dfad1dd7ebe4daee483e3fcd7;p=p5sagit%2Fp5-mst-13.2.git Make UTF-8 locales effective only if PerlIO has been defined (ignore UTF-8 locales silently if no PerlIO). p4raw-id: //depot/perl@17180 --- diff --git a/locale.c b/locale.c index 1abda3e..bb497bc 100644 --- a/locale.c +++ b/locale.c @@ -473,8 +473,10 @@ Perl_init_i18nl10n(pTHX_ int printwarn) #endif /* USE_LOCALE */ +#ifdef USE_PERLIO { - /* Set PL_wantut8 to TRUE if any of the following are true: + /* Set PL_wantut8 to TRUE if using PerlIO _and_ + any of the following are true: - nl_langinfo(CODESET) contains /^utf-?8/i - $ENV{LANGUAGE} contains /^utf-?8/i (only if using glibc) - $ENV{LC_CALL} contains /^utf-?8/i @@ -518,6 +520,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn) if (wantutf8) PL_wantutf8 = TRUE; } +#endif #ifdef USE_LOCALE_CTYPE if (curctype != NULL) diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 11e022f..257c395 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -340,7 +340,9 @@ for more information about UTF-8. If your environment variables (LC_ALL, LC_CTYPE, LANG, LANGUAGE) look like you want to use UTF-8 (any of the the variables match C), your STDIN, STDOUT, STDERR handles and the default open discipline -(see L) are marked as UTF-8. +(see L) are marked as UTF-8. (This feature, like other new +features that combine Unicode and I/O, work only if you are using +PerlIO, but that's is the default.) Note that after this Perl really does assume that everything is UTF-8: for example if some input handle is not, Perl will probably very soon diff --git a/pod/perluniintro.pod b/pod/perluniintro.pod index 8222e70..1468ae3 100644 --- a/pod/perluniintro.pod +++ b/pod/perluniintro.pod @@ -181,6 +181,11 @@ been led to believe that STDIN should be UTF-8, but then STDIN coming in from another command is not UTF-8, Perl will complain about the malformed UTF-8. +All features that combine Unicode and I/O also require using the new +PerlIO feature. Almost all Perl 5.8 platforms do use PerlIO, though: +you can see whether yours is by running "perl -V" and looking for +C. + =head2 Unicode and EBCDIC Perl 5.8.0 also supports Unicode on EBCDIC platforms. There, @@ -428,9 +433,7 @@ UTF-8 encoded. A C would have avoided the bug, or explicitly opening also the F for input as UTF-8. B: the C<:utf8> and C<:encoding> features work only if your -Perl has been built with the new "perlio" feature. Almost all -Perl 5.8 platforms do use "perlio", though: you can see whether -yours is by running "perl -V" and looking for C. +Perl has been built with the new PerlIO feature. =head2 Displaying Unicode As Text