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

ruby-changes:13733

From: naruse <ko1@a...>
Date: Wed, 28 Oct 2009 15:06:25 +0900 (JST)
Subject: [ruby-changes:13733] Ruby:r25526 (trunk): * encoding.c (get_filesystem_encoding):

naruse	2009-10-28 15:06:10 +0900 (Wed, 28 Oct 2009)

  New Revision: 25526

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25526

  Log:
    * encoding.c (get_filesystem_encoding):
      add Encoding.filesystem_encoding [ruby-dev:39546]
      also see [ruby-core:25959]

  Modified files:
    trunk/ChangeLog
    trunk/encoding.c

Index: encoding.c
===================================================================
--- encoding.c	(revision 25525)
+++ encoding.c	(revision 25526)
@@ -1118,6 +1118,22 @@
     return enc;
 }
 
+/*
+ * call-seq:
+ *   Encoding.filesystem_encoding => enc
+ *
+ * Returns filesystem encoding.
+ *
+ * It is locale encoding on Unix,
+ * the currrent ANSI (or OEM unless AreFileApisANSI) code page on Windows,
+ * UTF-8 on Mac OS X.
+ */
+static VALUE
+get_filesystem_encoding(VALUE klass)
+{
+    return rb_enc_from_encoding(rb_filesystem_encoding());
+}
+
 struct default_encoding {
     int index;			/* -2 => not yet set, -1 => nil */
     rb_encoding *enc;
@@ -1463,6 +1479,7 @@
     rb_define_method(rb_cEncoding, "_dump", enc_dump, -1);
     rb_define_singleton_method(rb_cEncoding, "_load", enc_load, 1);
 
+    rb_define_singleton_method(rb_cEncoding, "filesystem_encoding", get_filesystem_encoding, 0);
     rb_define_singleton_method(rb_cEncoding, "default_external", get_default_external, 0);
     rb_define_singleton_method(rb_cEncoding, "default_external=", set_default_external, 1);
     rb_define_singleton_method(rb_cEncoding, "default_internal", get_default_internal, 0);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 25525)
+++ ChangeLog	(revision 25526)
@@ -1,3 +1,9 @@
+Wed Oct 28 14:24:45 2009  NARUSE, Yui  <naruse@r...>
+
+	* encoding.c (get_filesystem_encoding):
+	  add Encoding.filesystem_encoding [ruby-dev:39546]
+	  also see [ruby-core:25959]
+
 Wed Oct 28 14:51:31 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/etc/etc.c (etc_each_group): fixed typo.
@@ -2,2 +8,3 @@
 
+
 Wed Oct 28 13:02:10 2009  Shugo Maeda  <shugo@r...>

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

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