summaryrefslogtreecommitdiff
path: root/ext/Encode/Encode.xs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/Encode/Encode.xs')
-rw-r--r--ext/Encode/Encode.xs9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/Encode/Encode.xs b/ext/Encode/Encode.xs
index 299af4471f..e7d8c6f5c7 100644
--- a/ext/Encode/Encode.xs
+++ b/ext/Encode/Encode.xs
@@ -102,12 +102,15 @@ PerlIOEncode_pushed(PerlIO *f, const char *mode, SV *arg)
e->enc = Nullsv;
errno = EINVAL;
Perl_warner(aTHX_ WARN_IO, "Cannot find encoding \"%"SVf"\"", arg);
- return -1;
+ code = -1;
+ }
+ else
+ {
+ SvREFCNT_inc(e->enc);
+ PerlIOBase(f)->flags |= PERLIO_F_UTF8;
}
- SvREFCNT_inc(e->enc);
FREETMPS;
LEAVE;
- PerlIOBase(f)->flags |= PERLIO_F_UTF8;
return code;
}