mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (make_writeconv): choose ASCII compatible encoding as
intermediate encoding if stateful encoder exists. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
020e681eec
commit
a788a2e531
2 changed files with 13 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun Sep 7 12:44:26 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* io.c (make_writeconv): choose ASCII compatible encoding as
|
||||
intermediate encoding if stateful encoder exists.
|
||||
|
||||
Sun Sep 7 12:09:29 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* include/ruby/encoding.h (ECONV_XML_ATTR_CONTENT_ENCODER): defined.
|
||||
|
|
8
io.c
8
io.c
|
@ -729,6 +729,14 @@ make_writeconv(rb_io_t *fptr)
|
|||
denc = enc->name;
|
||||
fptr->writeconv_stateless = rb_str_new2(senc);
|
||||
}
|
||||
else if ((fptr->encs.ecflags & ECONV_STATEFUL_ENCODER_MASK) && !rb_enc_asciicompat(enc)) {
|
||||
/* xxx: stateful encoder works for ASCII compatible encoding.
|
||||
* So we need to choose an encoding which is ASCII compatible and superset of enc.
|
||||
* For encodings which is superset of UTF-8, UTF-8 is not appropriate choice. */
|
||||
senc = "UTF-8";
|
||||
denc = enc->name;
|
||||
fptr->writeconv_stateless = rb_str_new2("UTF-8");
|
||||
}
|
||||
else {
|
||||
senc = denc = "";
|
||||
fptr->writeconv_stateless = rb_str_new2(enc->name);
|
||||
|
|
Loading…
Add table
Reference in a new issue