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

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

Thread Previous | Thread Next
Leon Timmermans
February 20, 2017 23:19
Re: Proposal: Rename utf8::is_utf8() to utf8::is_upgraded()
Message ID:
On Mon, Feb 20, 2017 at 9:46 PM, Kent Fredric <> wrote:

>   *   "$flag = utf8::is_upgraded($string)"
>          (Since Perl 5.28) Test whether $string 's internal bytes are
> marked
>          for interpretation via utf8 semantics or not. Note this bears
> no impact on whether that
>          data is actually utf8, only how perl functions such as
> "length" should treat its bytes.
>  *   "$flag = utf8::is_utf8($string)"
>          (Since Perl 5.8.1) Compatibility-supporting (but poorly named)
> alias of
>          utf8::is_upgraded
> Its a bit wordy, but probably progress.

I think it would be helpful to explicitly mention that the whole «encode if
is_utf8» is essentially always wrong. And to link to a longer explanation
in perlunisomething of why it is wrong.

Though that said, I think we can find a clearer name than "is_upgraded"



Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About