summaryrefslogtreecommitdiff
path: root/cpan/MIME-Base64/Base64.xs
diff options
context:
space:
mode:
Diffstat (limited to 'cpan/MIME-Base64/Base64.xs')
-rw-r--r--cpan/MIME-Base64/Base64.xs14
1 files changed, 12 insertions, 2 deletions
diff --git a/cpan/MIME-Base64/Base64.xs b/cpan/MIME-Base64/Base64.xs
index 5bac9ec479..695e24a179 100644
--- a/cpan/MIME-Base64/Base64.xs
+++ b/cpan/MIME-Base64/Base64.xs
@@ -107,10 +107,11 @@ encode_base64(sv,...)
STRLEN rlen; /* length of result string */
unsigned char c1, c2, c3;
int chunk;
+ bool utf8_downgraded;
CODE:
#if PERL_REVISION == 5 && PERL_VERSION >= 6
- sv_utf8_downgrade(sv, FALSE);
+ utf8_downgraded = sv_utf8_downgrade(sv, FALSE);
#endif
str = SvPV(sv, rlen); /* SvPV(sv, len) gives warning for signed len */
len = (SSize_t)rlen;
@@ -169,6 +170,10 @@ encode_base64(sv,...)
*r++ = *c++;
}
*r = '\0'; /* every SV in perl should be NUL-terminated */
+#if PERL_REVISION == 5 && PERL_VERSION >= 6
+ if (utf8_downgraded)
+ sv_utf8_upgrade(sv);
+#endif
OUTPUT:
RETVAL
@@ -317,10 +322,11 @@ encode_qp(sv,...)
char *p;
char *p_beg;
STRLEN p_len;
+ bool utf8_downgraded;
CODE:
#if PERL_REVISION == 5 && PERL_VERSION >= 6
- sv_utf8_downgrade(sv, FALSE);
+ utf8_downgraded = sv_utf8_downgrade(sv, FALSE);
#endif
/* set up EOL from the second argument if present, default to "\n" */
if (items > 1 && SvOK(ST(1))) {
@@ -412,6 +418,10 @@ encode_qp(sv,...)
sv_catpvn(RETVAL, "=", 1);
sv_catpvn(RETVAL, eol, eol_len);
}
+#if PERL_REVISION == 5 && PERL_VERSION >= 6
+ if (utf8_downgraded)
+ sv_utf8_upgrade(sv);
+#endif
OUTPUT:
RETVAL