This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8.h: Add macro that handled malformed 2-byte UTF-8
authorKarl Williamson <public@khwilliamson.com>
Thu, 8 Nov 2012 19:04:34 +0000 (12:04 -0700)
committerKarl Williamson <public@khwilliamson.com>
Sun, 11 Nov 2012 18:50:11 +0000 (11:50 -0700)
commit4ab10950b702d3352c12c94c5c910a0f5cc1ca97
tree2952dc14cddf43c2cb753d3a3456b306c30271f1
parent223f01dbd9ed14415f68a748bb69e783b9c46685
utf8.h: Add macro that handled malformed 2-byte UTF-8

The macro used traditionally to see if there is a two-byte UTF-8
sequence doesn't make sure that there actually is a second byte
available; it only checks if the first byte indicates that there is.
This adds a macro that is safe in the face of malformed UTF-8.

I inspected the existing calls in the core to the unsafe macro, and I
believe that none of them need to be converted to the safe version.
utf8.h