summaryrefslogtreecommitdiffstats
path: root/transcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/transcode.c b/transcode.c
index 6496c75c7..3dbdb44d1 100644
--- a/transcode.c
+++ b/transcode.c
@@ -913,6 +913,19 @@ rb_econv_open(const char *sname, const char *dname, int ecflags)
}
num_additional = 0;
+
+ if (*sname && (!senc || !rb_enc_asciicompat(senc)) &&
+ (ecflags & (ECONV_CRLF_NEWLINE_ENCODER|ECONV_CR_NEWLINE_ENCODER))) {
+ xfree(entries);
+ return NULL;
+ }
+
+ if (*dname && (!denc || !rb_enc_asciicompat(denc)) &&
+ (ecflags & (ECONV_UNIVERSAL_NEWLINE_DECODER))) {
+ xfree(entries);
+ return NULL;
+ }
+
if ((!*sname || (senc && rb_enc_asciicompat(senc))) &&
(ecflags & (ECONV_CRLF_NEWLINE_ENCODER|ECONV_CR_NEWLINE_ENCODER))) {
const char *name = (ecflags & ECONV_CRLF_NEWLINE_ENCODER) ? "crlf_newline" : "cr_newline";