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

ruby-changes:8189

From: suke <ko1@a...>
Date: Wed, 8 Oct 2008 21:05:50 +0900 (JST)
Subject: [ruby-changes:8189] Ruby:r19717 (trunk): * ext/win32ole/win32ole.c (ole_init_cp): initialize WIN32OLE.codepage

suke	2008-10-08 21:05:18 +0900 (Wed, 08 Oct 2008)

  New Revision: 19717

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

  Log:
    * ext/win32ole/win32ole.c (ole_init_cp): initialize WIN32OLE.codepage
      according to Encoding.default_internal and
      Encoding.default_external.

  Modified files:
    trunk/ChangeLog
    trunk/ext/win32ole/win32ole.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19716)
+++ ChangeLog	(revision 19717)
@@ -1,3 +1,9 @@
+Wed Oct  8 20:59:52 2008  Masaki Suketa  <masaki.suketa@n...>
+
+	* ext/win32ole/win32ole.c (ole_init_cp): initialize WIN32OLE.codepage
+	  according to Encoding.default_internal and
+	  Encoding.default_external.
+
 Wed Oct  8 17:02:21 2008  NARUSE, Yui  <naruse@r...>
 
 	* ext/json/lib/json/pure/generator.rb (utf8_to_json):
Index: ext/win32ole/win32ole.c
===================================================================
--- ext/win32ole/win32ole.c	(revision 19716)
+++ ext/win32ole/win32ole.c	(revision 19717)
@@ -118,7 +118,7 @@
 
 #define WC2VSTR(x) ole_wc2vstr((x), TRUE)
 
-#define WIN32OLE_VERSION "1.3.3"
+#define WIN32OLE_VERSION "1.3.4"
 
 typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
     (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@@ -961,7 +961,10 @@
 {
     UINT cp;
     rb_encoding *encdef;
-    encdef = rb_default_external_encoding();
+    encdef = rb_default_internal_encoding();
+    if (!encdef) {
+	encdef = rb_default_external_encoding();
+    }
     cp = ole_encoding2cp(encdef);
     if (code_page_installed(cp)) {
         cWIN32OLE_cp = cp;
@@ -2908,9 +2911,14 @@
  *  call-seq:
  *     WIN32OLE.codepage = CP
  * 
- *  Sets current codepage.
+ *  Sets current codepage. 
+ *  The WIN32OLE.codepage is initialized according to 
+ *  Encoding.default_internal.
+ *  If Encoding.default_internal is nil then WIN32OLE.codepage
+ *  is initialized according to Encoding.default_external.
+ *
  *     WIN32OLE.codepage = WIN32OLE::CP_UTF8
- *     WIN32OLE.codepage = 20932
+ *     WIN32OLE.codepage = 65001
  */
 static VALUE
 fole_s_set_code_page(VALUE self, VALUE vcp)

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

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