From b7212ba643b8db2a580c457f6189385f00db5d99 Mon Sep 17 00:00:00 2001 From: suke Date: Wed, 8 Oct 2008 12:05:18 +0000 Subject: * ext/win32ole/win32ole.c (ole_init_cp): initialize WIN32OLE.codepage according to Encoding.default_internal and Encoding.default_external. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/win32ole/win32ole.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'ext/win32ole') diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c index 0f07844deb..915ffb35ea 100644 --- a/ext/win32ole/win32ole.c +++ b/ext/win32ole/win32ole.c @@ -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 @@ ole_init_cp() { 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 @@ code_page_installed(UINT cp) * 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) -- cgit v1.2.3