summaryrefslogtreecommitdiff
path: root/encoding.c
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 /encoding.c
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
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c16
1 files changed, 16 insertions, 0 deletions
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 *