X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=mg.c;h=2e528ba53854aa1310b74edd39cb32c5728c4861;hb=e9c1fd70a0c901791f5a7169cb6bf808e7e42d7a;hp=f3fc0359521cfe38aac2d23ad0900422a5e59c7f;hpb=764df951e4265f932b70873d1d56431da2d2763f;p=p5sagit%2Fp5-mst-13.2.git diff --git a/mg.c b/mg.c index f3fc035..2e528ba 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; } @@ -2084,12 +2090,12 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) * the setproctitle() routine to manipulate that. */ { s = SvPV(sv, len); -# if __FreeBSD_version >= 410001 +# if __FreeBSD_version > 410001 /* The leading "-" removes the "perl: " prefix, * but not the "(perl) suffix from the ps(1) * output, because that's what ps(1) shows if the * argv[] is modified. */ - setproctitle("-%s", s, len + 1); + setproctitle("-%s", s); # else /* old FreeBSDs, NetBSD, OpenBSD, anyBSD */ /* This doesn't really work if you assume that * $0 = 'foobar'; will wipe out 'perl' from the $0