summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-16 21:28:03 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-16 21:28:03 +0000
commit2755479bd9224d8cdbe9b58790cd8a38fc38d1cd (patch)
treed0d182c586c99756dd611b93589f616068e9a62a
parentaaf1b728730be8012b915ce498e4f793586ec46b (diff)
downloadruby-2755479bd9224d8cdbe9b58790cd8a38fc38d1cd.tar.gz
* encoding.c (rb_filesystem_encoding): defined.
* include/ruby/encoding.h (rb_filesystem_encoding): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--encoding.c16
-rw-r--r--include/ruby/encoding.h1
3 files changed, 23 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 82ae100391..44e3d8571e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Jun 17 06:26:28 2008 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * encoding.c (rb_filesystem_encoding): defined.
+
+ * include/ruby/encoding.h (rb_filesystem_encoding): added.
+
Tue Jun 17 06:24:28 2008 NARUSE, Yui <naruse@ruby-lang.org>
* ext/syck/rubyext.c: add encoding header.
diff --git a/encoding.c b/encoding.c
index 0928b4b2b0..305213569c 100644
--- a/encoding.c
+++ b/encoding.c
@@ -962,6 +962,22 @@ rb_locale_encoding(void)
return rb_enc_from_index(idx);
}
+rb_encoding *
+rb_filesystem_encoding(void)
+{
+ static rb_encoding *enc;
+ if (!enc) {
+#if defined _WIN32
+ enc = rb_locale_encoding();
+#elif defined __APPLE__
+ enc = rb_enc_find("UTF8-MAC");
+#else
+ enc = rb_ascii8bit_encoding();
+#endif
+ }
+ return enc;
+}
+
static int default_external_index;
rb_encoding *
diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h
index 1955a4f205..33a8fcd73e 100644
--- a/include/ruby/encoding.h
+++ b/include/ruby/encoding.h
@@ -165,6 +165,7 @@ rb_encoding *rb_ascii8bit_encoding(void);
rb_encoding *rb_utf8_encoding(void);
rb_encoding *rb_usascii_encoding(void);
rb_encoding *rb_locale_encoding(void);
+rb_encoding *rb_filesystem_encoding(void);
rb_encoding *rb_default_external_encoding(void);
int rb_usascii_encindex(void);
int rb_ascii8bit_encindex(void);