summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <dan@berrange.com>2001-08-03 12:39:33 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2001-08-04 14:12:45 +0000
commit5636d5186838c19e5d814e8b62c9342c926b3bb0 (patch)
treee108641928b6fb203dc53bccbb7abd4514c08bbc /mg.c
parent45dea987ac01a22d305c6aa3413f540409537f26 (diff)
downloadperl-5636d5186838c19e5d814e8b62c9342c926b3bb0.tar.gz
UTF-8 bugs in string length & single line regex matches
Message-ID: <20010803113932.A19318@berrange.com> (the mg_length() fix) p4raw-id: //depot/perl@11572
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/mg.c b/mg.c
index 5a8c189e82..2e528ba538 100644
--- a/mg.c
+++ b/mg.c
@@ -185,7 +185,13 @@ Perl_mg_length(pTHX_ SV *sv)
}
}
- (void)SvPV(sv, len);
+ if (DO_UTF8(sv))
+ {
+ U8 *s = (U8*)SvPV(sv, len);
+ len = Perl_utf8_length(aTHX_ s, s + len);
+ }
+ else
+ (void)SvPV(sv, len);
return len;
}