mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* 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:
parent
d4384f1230
commit
0be34e2a49
3 changed files with 40 additions and 0 deletions
13
transcode.c
13
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";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue