In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/b2e7ed74dcabdba63e3e8e2ff1980e1cd109b869?hp=8276e333951d35e9f1f651314089b54c9a3762c4>
- Log ----------------------------------------------------------------- commit b2e7ed74dcabdba63e3e8e2ff1980e1cd109b869 Author: Karl Williamson <k...@cpan.org> Date: Sun Nov 26 22:32:58 2017 -0700 Fix and clarify the pod for utf8_length() Contrary to what it previously said, it does not croak. This clarifies what happens if the start and end pointers have the same value. ----------------------------------------------------------------------- Summary of changes: utf8.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/utf8.c b/utf8.c index 87017fad34..3123bd0182 100644 --- a/utf8.c +++ b/utf8.c @@ -2004,9 +2004,12 @@ Perl_utf8_to_uvuni_buf(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen) /* =for apidoc utf8_length -Return the length of the UTF-8 char encoded string C<s> in characters. -Stops at C<e> (i.e. the C<*e> byte does not form part of the character). -If C<e E<lt> s> or if the scan would end up past C<e>, it croaks. +Returns the number of characters in the sequence of UTF-8-encoded bytes starting +at C<s> and ending at the byte just before C<e>. If <s> and <e> point to the +same place, it returns 0 with no warning raised. + +If C<e E<lt> s> or if the scan would end up past C<e>, it raises a UTF8 warning +and returns the number of valid characters. =cut */ -- Perl5 Master Repository