Subject: | Malformed UTF-8 character warnings in Perl 5.10 with utf8 pragma on |
The following code in Perl 5.10:
use utf8;
use Types::Standard qw/Dict Int/;
use Type::Params qw/compile/;
compile( Dict [ foo => Int ] );
Will generate the following output:
Malformed UTF-8 character (unexpected continuation byte 0xb8, with no preceding start byte) in subroutine entry at lib/Type/Params.pm line 155.
Malformed UTF-8 character (unexpected non-continuation byte 0x3b, immediately after start byte 0xd0) in subroutine entry at lib/Type/Params.pm line 155.
Malformed UTF-8 character (unexpected non-continuation byte 0x78, immediately after start byte 0xf8) in subroutine entry at lib/Type/Params.pm line 155.
Malformed UTF-8 character (unexpected non-continuation byte 0x3b, immediately after start byte 0xd0) in subroutine entry at lib/Type/Params.pm line 155.
Malformed UTF-8 character (unexpected non-continuation byte 0x3b, immediately after start byte 0xd0) in subroutine entry at lib/Type/Params.pm line 155.
Malformed UTF-8 character (unexpected continuation byte 0xb8, with no preceding start byte) in subroutine entry at lib/Type/Params.pm line 155.
...
I have not tested older versions of Perl (5.8, 5.6), but I believe they will fail too.
After 5.10, B::perlstring() was made an alias to B::cstring():
http://perl5.git.perl.org/perl.git/commitdiff/84556172294db864f27a4b5df6dac9127e1e7205
If we replace all instances of B::perlstring with B::cstring in the "compile" subroutine in Test::Params, the issue goes away.
I'll make a pull request with a test case on GitHub.