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

ruby-changes:19938

From: naruse <ko1@a...>
Date: Fri, 10 Jun 2011 16:42:36 +0900 (JST)
Subject: [ruby-changes:19938] naruse:r31985 (trunk): * encoding.c (rb_locale_charmap): When ruby process is run as Windows

naruse	2011-06-10 16:42:24 +0900 (Fri, 10 Jun 2011)

  New Revision: 31985

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

  Log:
    * encoding.c (rb_locale_charmap): When ruby process is run as Windows
      Service the console codepage is not set, GetConsoleCP returns 0.
      So on such environment, use GetACP().
      http://blogs.msdn.com/b/michkap/archive/2005/02/08/369197.aspx
      patched by Rafal Bigaj [ruby-core:36832] [Bug #4854]

  Modified files:
    trunk/ChangeLog
    trunk/encoding.c

Index: encoding.c
===================================================================
--- encoding.c	(revision 31984)
+++ encoding.c	(revision 31985)
@@ -1427,7 +1427,9 @@
     const char *codeset = nl_langinfo_codeset();
     char cp[sizeof(int) * 3 + 4];
     if (!codeset) {
-	snprintf(cp, sizeof(cp), "CP%d", GetConsoleCP());
+	UINT codepage = GetConsoleCP();
+	if(!codepage) codepage = GetACP();
+	snprintf(cp, sizeof(cp), "CP%d", codepage);
 	codeset = cp;
     }
     return rb_usascii_str_new2(codeset);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 31984)
+++ ChangeLog	(revision 31985)
@@ -1,3 +1,11 @@
+Fri Jun 10 16:38:13 2011  NARUSE, Yui  <naruse@r...>
+
+	* encoding.c (rb_locale_charmap): When ruby process is run as Windows
+	  Service the console codepage is not set, GetConsoleCP returns 0.
+	  So on such environment, use GetACP().
+	  http://blogs.msdn.com/b/michkap/archive/2005/02/08/369197.aspx
+	  patched by Rafal Bigaj [ruby-core:36832] [Bug #4854]
+
 Fri Jun 10 14:34:24 2011  Koichi Sasada  <ko1@a...>
 
 	* common.mk: restore TESTRUN_SCRIPT to "$(srcdir)/test.rb".

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

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