From: Abhijit Menon-Sen Date: Tue, 5 Nov 2002 03:43:46 +0000 (+0000) Subject: 1. Update pp_ucfirst to enter the UTF-8 branch only if the first X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=34aa158557bf899117e749eb5a8375ffe870f5d0;p=p5sagit%2Fp5-mst-13.2.git 1. Update pp_ucfirst to enter the UTF-8 branch only if the first character is UTF-8. (Copied from pp_lcfirst.) 2. sv_dump() should display FLAGS=...,UTF8 for both POK and pPOK. p4raw-id: //depot/perl@18107 --- diff --git a/dump.c b/dump.c index ab74f41..5dc1e5c 100644 --- a/dump.c +++ b/dump.c @@ -1021,7 +1021,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo sv_catpv(d, "TYPED,"); break; } - if (SvPOK(sv) && SvUTF8(sv)) + if ((SvPOK(sv) || SvPOKp(sv)) && SvUTF8(sv)) sv_catpv(d, "UTF8"); if (*(SvEND(d) - 1) == ',') diff --git a/pp.c b/pp.c index 47e512c..4c05aab 100644 --- a/pp.c +++ b/pp.c @@ -3323,14 +3323,12 @@ PP(pp_ucfirst) register U8 *s; STRLEN slen; - if (DO_UTF8(sv)) { + if (DO_UTF8(sv) && (s = (U8*)SvPV(sv, slen)) && slen && UTF8_IS_START(*s)) { U8 tmpbuf[UTF8_MAXLEN_UCLC+1]; STRLEN ulen; STRLEN tculen; - s = (U8*)SvPV(sv, slen); utf8_to_uvchr(s, &ulen); - toTITLE_utf8(s, tmpbuf, &tculen); utf8_to_uvchr(tmpbuf, 0); @@ -3385,7 +3383,6 @@ PP(pp_lcfirst) toLOWER_utf8(s, tmpbuf, &ulen); uv = utf8_to_uvchr(tmpbuf, 0); - tend = uvchr_to_utf8(tmpbuf, uv); if (!SvPADTMP(sv) || (STRLEN)(tend - tmpbuf) != ulen || SvREADONLY(sv)) {