summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--t/lib/warnings/utf813
-rw-r--r--utf8.c2
2 files changed, 14 insertions, 1 deletions
diff --git a/t/lib/warnings/utf8 b/t/lib/warnings/utf8
index af04d4c54b..64f08290de 100644
--- a/t/lib/warnings/utf8
+++ b/t/lib/warnings/utf8
@@ -783,3 +783,16 @@ BEGIN{
{};$^H=eval'2**400'}Â
EXPECT
Malformed UTF-8 character: \xc2\x0a (unexpected non-continuation byte 0x0a, immediately after start byte 0xc2; need 2 bytes, got 1) at - line 11.
+########
+# NAME [perl #131646]
+BEGIN{
+ if (ord('A') == 193) {
+ print "SKIPPED\n# ebcdic platforms generates different Malformed UTF-8 warnings.";
+ exit 0;
+ }
+}
+no warnings;
+use warnings 'utf8';
+for(uc 0..t){0~~pack"UXp>",exp}
+EXPECT
+Malformed UTF-8 character: \xc2\x00 (unexpected non-continuation byte 0x00, immediately after start byte 0xc2; need 2 bytes, got 1) in smart match at - line 9.
diff --git a/utf8.c b/utf8.c
index 4949bf6584..a3d5f61b64 100644
--- a/utf8.c
+++ b/utf8.c
@@ -1880,7 +1880,7 @@ Perl_bytes_cmp_utf8(pTHX_ const U8 *b, STRLEN blen, const U8 *u, STRLEN ulen)
/* diag_listed_as: Malformed UTF-8 character%s */
Perl_ck_warner_d(aTHX_ packWARN(WARN_UTF8),
"%s %s%s",
- unexpected_non_continuation_text(u - 1, 2, 1, 2),
+ unexpected_non_continuation_text(u - 2, 2, 1, 2),
PL_op ? " in " : "",
PL_op ? OP_DESC(PL_op) : "");
return -2;