[前][次][番号順一覧][スレッド一覧]

ruby-changes:3050

From: ko1@a...
Date: 24 Dec 2007 02:39:01 +0900
Subject: [ruby-changes:3050] matz - Ruby:r14542 (trunk): * io.c (rb_io_external_encoding): should return the encoding of

matz	2007-12-24 02:38:32 +0900 (Mon, 24 Dec 2007)

  New Revision: 14542

  Modified files:
    trunk/ChangeLog
    trunk/io.c

  Log:
    * io.c (rb_io_external_encoding): should return the encoding of
      the file reading.
    
    * io.c (rb_io_internal_encoding): should return the encoding of
      read string.

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14542&r2=14541
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/io.c?r1=14542&r2=14541

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14541)
+++ ChangeLog	(revision 14542)
@@ -6,6 +6,12 @@
 
 	* io.c (io_fwrite): wrong encoding destination.
 
+	* io.c (rb_io_external_encoding): should return the encoding of
+	  the file reading.
+
+	* io.c (rb_io_internal_encoding): should return the encoding of
+	  read string.
+
 Mon Dec 24 01:46:43 2007  Yukihiro Matsumoto  <matz@r...>
 
 	* io.c (rb_io_s_pipe): allow specifying read-side encoding.
Index: io.c
===================================================================
--- io.c	(revision 14541)
+++ io.c	(revision 14542)
@@ -5848,6 +5848,9 @@
     rb_io_t *fptr;
 
     GetOpenFile(io, fptr);
+    if (fptr->enc2) {
+	return rb_enc_from_encoding(fptr->enc2);
+    }
     if (!fptr->enc && fptr->fd == 0) {
 	fptr->enc = rb_default_external_encoding();
     }
@@ -5869,7 +5872,7 @@
 
     GetOpenFile(io, fptr);
     if (!fptr->enc2) return Qnil;
-    return rb_enc_from_encoding(fptr->enc2);
+    return rb_enc_from_encoding(fptr->enc);
 }
 
 static VALUE

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]