develooper Front page | perl.perl5.porters | Postings from August 2013

Re: [perl #117355] [lu]cfirst don't respect 'use bytes'

Thread Previous | Thread Next
From:
Eric Brine
Date:
August 13, 2013 03:51
Subject:
Re: [perl #117355] [lu]cfirst don't respect 'use bytes'
Message ID:
CALJW-qH455JKOoAgHJcmckJZ6QRj5_gicGSQskK0oFsB3h61Gw@mail.gmail.com
On Mon, Aug 12, 2013 at 5:17 PM, Victor Efimov via RT <
perlbug-followup@perl.org> wrote:

> On Mon Aug 12 13:57:25 2013, ikegami@adaelis.com wrote:
> > On Mon, Aug 12, 2013 at 4:08 PM, Victor Efimov via RT <
> > perlbug-followup@perl.org> wrote:
> > >
> > > sub try_drop_utf8_flag
> > > {
> > >   Encode::_utf8_off($_[0]) if utf8::is_utf8($_[0]) &&
> > > (bytes::length($_[0]) == length($_[0]));
> > > }
> >
> >
> > That's just C<< utf8::downgrade($_[0], 1) >>
>
> Yes, you are right, except one small difference.
> For characters > 127, but <= 255 it works different way.
> Thus it cannot be used, when strings are filenames (like in example
> above, also another example below).
>

I see, but it's still not a reason to keep bytes. It simply means we need
to add a function downgrades only ASCII-only strings.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About