summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-01-05 00:47:23 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-01-05 00:47:23 +0000
commita0dbb04553005cdbafdeb7435a79ae500b5aa8ff (patch)
treec3c2af7757f55ba66089c19094e138ecb04cb469 /pp.c
parent7a800fca3140c85b8a41515633e9bb98c38e5603 (diff)
downloadperl-a0dbb04553005cdbafdeb7435a79ae500b5aa8ff.tar.gz
Unify UTF-8 malformedness handling.
p4raw-id: //depot/perl@8323
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/pp.c b/pp.c
index 950d85a459..1ea2a07566 100644
--- a/pp.c
+++ b/pp.c
@@ -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;