develooper Front page | perl.perl5.porters | Postings from July 2017

Re: [perl #131685] Rename utf8::is_utf8() (and other functions)

Thread Previous | Thread Next
From:
Tony Cook
Date:
July 4, 2017 01:59
Subject:
Re: [perl #131685] Rename utf8::is_utf8() (and other functions)
Message ID:
20170704015922.GH27607@mars.tony.develop-help.com
On Mon, Jul 03, 2017 at 09:35:06PM -0400, Dan Book wrote:
> On Mon, Jul 3, 2017 at 8:38 PM, Tony Cook <tony@develop-help.com> wrote:
> >
> >
> > As a side note, the original thread refers to:
> >
> > https://metacpan.org/source/SHAY/perl-5.24.1/cpan/Archive-
> > Tar/lib/Archive/Tar.pm#L1501
> >
> > which I could see as correct because of the way perl's unicode support
> > (fails to) deal with filenames.
> >
> > Tony
> >
> 
> Not entirely correct IMO. If the intent is that filenames be encoded to
> UTF-8, this will fail to encode downgraded names with non-ascii characters.

If the caller creates a file using the name they pass in, encoding the
name (which might not be utf-8 marked) may make the later -e or -l
check fail.

Perl functions such as open and stat currently ignore the the UTF-8
flag, which makes this pretty messy.

The code in Archive::Tar seems a reasonable workaround to me, I don't
think the author had much choice.

Tony

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