This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
ensure utf8::encode() normalises its arg
authorDave Mitchell <davem@fdisolutions.com>
Thu, 4 Mar 2004 23:56:42 +0000 (23:56 +0000)
committerDave Mitchell <davem@fdisolutions.com>
Thu, 4 Mar 2004 23:56:42 +0000 (23:56 +0000)
p4raw-id: //depot/perl@22439

sv.c

diff --git a/sv.c b/sv.c
index dd15758..ed6051a 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3470,13 +3470,13 @@ Perl_sv_utf8_upgrade_flags(pTHX_ register SV *sv, I32 flags)
             return len;
     }
 
-    if (SvUTF8(sv))
-       return SvCUR(sv);
-
     if (SvIsCOW(sv)) {
         sv_force_normal_flags(sv, 0);
     }
 
+    if (SvUTF8(sv))
+       return SvCUR(sv);
+
     if (PL_encoding && !(flags & SV_UTF8_NO_ENCODING))
         sv_recode_to_utf8(sv, PL_encoding);
     else { /* Assume Latin-1/EBCDIC */