diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-01-05 00:47:23 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-01-05 00:47:23 +0000 |
commit | a0dbb04553005cdbafdeb7435a79ae500b5aa8ff (patch) | |
tree | c3c2af7757f55ba66089c19094e138ecb04cb469 /pp.c | |
parent | 7a800fca3140c85b8a41515633e9bb98c38e5603 (diff) | |
download | perl-a0dbb04553005cdbafdeb7435a79ae500b5aa8ff.tar.gz |
Unify UTF-8 malformedness handling.
p4raw-id: //depot/perl@8323
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -3978,20 +3978,17 @@ PP(pp_reverse) U8* s = (U8*)SvPVX(TARG); U8* send = (U8*)(s + len); while (s < send) { - if (*s < 0x80) { + if (UTF8_IS_ASCII(*s)) { s++; continue; } else { + if (!utf8_to_uv_simple(s, 0)) + break; up = (char*)s; s += UTF8SKIP(s); down = (char*)(s - 1); - if (s > send || !((*down & 0xc0) == 0x80)) { - if (ckWARN_d(WARN_UTF8)) - Perl_warner(aTHX_ WARN_UTF8, - "Malformed UTF-8 character"); - break; - } + /* reverse this character */ while (down > up) { tmp = *up; *up++ = *down; |