* transcode.c (rb_econv_open): fail for ASCII incompatible with

newline conversion.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-09-05 22:27:46 +00:00
parent d4384f1230
commit 0be34e2a49
3 changed files with 40 additions and 0 deletions

View file

@ -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";