FAQ
It appears [:print:] matches \t, \f and \r, unless UTF8 is in effect.
Is this what the POSIX definition of [:print:] is?


----- Forwarded message from "Keith C. Ivey" <kcivey@cpcug.org> -----

From: "Keith C. Ivey" <kcivey@cpcug.org>
To: fwp@perl.org
Subject: Re: isprint Golf Challenge
Priority: normal

Michael G Schwern wrote:
Hmmm, there seems to be a little problem:

$ perl -wle 'print "\n" =~ /[[:cntrl:]]/ ? "Yep" : "Nope"'
Yep
$ perl -wle 'print "\n" =~ /[[:print:]]/ ? "Yep" : "Nope"'
Yep
$ perl -Mutf8 -wle 'print "\n" =~ /[[:print:]]/ ? "Yep" :
"Nope"' Nope
I missed that when I was testing. There's the same problem
with "\t", "\f", and "\r" (ASCII 9, 12, and 13). Perl seems to
think that anything that matches \s is printable, rather than
just space.

--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC



----- End forwarded message -----

--

Michael G. Schwern <schwern@pobox.com> http://www.pobox.com/~schwern/
Perl Quality Assurance <perl-qa@perl.org> Kwalitee Is Job One
At the doctor's office
Winter wheat and water mix
I walk funny now.
-- ignatz

Search Discussions

  • Jarkko Hietaniemi at Nov 17, 2001 at 5:00 pm

    On Sat, Nov 17, 2001 at 12:18:22AM -0500, Michael G Schwern wrote:
    It appears [:print:] matches \t, \f and \r, unless UTF8 is in effect.
    Is this what the POSIX definition of [:print:] is?
    In blead [:print:] doesn't match \t \f \r \n with or without utf8.

    UTF-8 is an encoding. POSIX (character class definition) doesn't care
    about encodings. (Yes, I think Larry made a bad mistake by naming the
    pragma based on the encoding, not the character set/repertoire, that
    has caused no end to confusion and will no doubt continue to do so.)

    The utf8 pragma is almost completely obsoleted.

    --
    $jhi++; # http://www.iki.fi/jhi/
    # There is this special biologist word we use for 'stable'.
    # It is 'dead'. -- Jack Cohen

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl5-porters @
categoriesperl
postedNov 17, '01 at 5:20a
activeNov 17, '01 at 5:00p
posts2
users2
websiteperl.org

People

Translate

site design / logo © 2021 Grokbase