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

Re: Proposal: Rename utf8::is_utf8() to utf8::is_upgraded()

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
February 20, 2017 12:56
Subject:
Re: Proposal: Rename utf8::is_utf8() to utf8::is_upgraded()
Message ID:
CAHhgV8gAnQKUoKEFsSfZBHc=q_noZiG5s=G3e0Bfm-S9nmNbMg@mail.gmail.com
On Sun, Feb 19, 2017 at 7:51 PM, Kent Fredric <kentfredric@gmail.com> wrote:
> A better direction IMHO would be:
>
> 1. Remove is_utf8 from utf8.pm's synopsis
> 2. Make it *much* clearer in utf8.pm that is_utf8 is not something
> people should use, because the current description doesn't give any
> direction in this regard:
>
>     *   "$flag = utf8::is_utf8($string)"
>
>         (Since Perl 5.8.1) Test whether $string is marked internally as
>         encoded in UTF-8. Functionally the same as "Encode::is_utf8()".
>
> And the followed ref says:
>
>    is_utf8
>       is_utf8(STRING [, CHECK])
>
>     [INTERNAL] Tests whether the UTF8 flag is turned on in the STRING. If
>     CHECK is true, also checks whether STRING contains well-formed UTF-8.
>     Returns true if successful, false otherwise.
>
>     As of Perl 5.8.1, utf8 also has the "utf8::is_utf8" function.
>
> Doesn't really convey any sort of clarity here as to where and when it
> makes sense to use, or stipulate clearly that typical expectations of
> what this does is wrong.
>
> Can't expect people to do the right thing if even the documentation
> doesn't help.

Part of the challenge here is that it's hard to explain why people
should not be using it without them understanding our unicode model,
which doesn't fit in a function description. These functions living in
the utf8 namespace is rather unfortunate to begin with (it should have
been unicode) for that matter.

Leon

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