ruby-changes:2898
From: ko1@a...
Date: 21 Dec 2007 12:30:10 +0900
Subject: [ruby-changes:2898] matz - Ruby:r14389 (trunk): * io.c (rb_io_mode_enc): set default external encoding if no
matz 2007-12-21 12:29:54 +0900 (Fri, 21 Dec 2007)
New Revision: 14389
Modified files:
trunk/ChangeLog
trunk/io.c
Log:
* io.c (rb_io_mode_enc): set default external encoding if no
encoding specified explicitly.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14389&r2=14388
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/io.c?r1=14389&r2=14388
Index: ChangeLog
===================================================================
--- ChangeLog (revision 14388)
+++ ChangeLog (revision 14389)
@@ -10,6 +10,11 @@
* string.c (rb_str_is_ascii_only_p): new method ascii_only?.
+Fri Dec 21 12:11:57 2007 Yukihiro Matsumoto <matz@r...>
+
+ * io.c (rb_io_mode_enc): set default external encoding if no
+ encoding specified explicitly.
+
Fri Dec 21 12:00:34 2007 Tanaka Akira <akr@f...>
* configure.in: check langinfo.h and locale.h.
Index: io.c
===================================================================
--- io.c (revision 14388)
+++ io.c (revision 14389)
@@ -3068,6 +3068,9 @@
}
#endif
}
+ else if (!(fptr->mode & FMODE_BINMODE)) {
+ fptr->enc = rb_default_external_encoding();
+ }
}
struct sysopen_struct {
@@ -3188,8 +3191,8 @@
rb_io_t *fptr;
MakeOpenFile(io, fptr);
+ fptr->mode = rb_io_mode_flags(mode);
rb_io_mode_enc(fptr, mode);
- fptr->mode = rb_io_mode_flags(mode);
fptr->path = strdup(fname);
fptr->fd = rb_sysopen(fptr->path, rb_io_mode_modenum(rb_io_flags_mode(fptr->mode)), 0666);
io_check_tty(fptr);
@@ -3498,10 +3501,10 @@
port = io_alloc(rb_cIO);
MakeOpenFile(port, fptr);
- rb_io_mode_enc(fptr, mode);
fptr->fd = fd;
fptr->stdio_file = fp;
fptr->mode = modef | FMODE_SYNC|FMODE_DUPLEX;
+ rb_io_mode_enc(fptr, mode);
fptr->pid = pid;
if (0 <= write_fd) {
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml