From e64453aa697cc42bfaee51ed771b02898b142daa Mon Sep 17 00:00:00 2001 From: suke Date: Sun, 12 Oct 2008 09:06:45 +0000 Subject: * ext/win32ole/win32ole.c (set_ole_codepage, ole_cp2encoding, ole_wc2mb, ole_vstr2wc, ole_mb2wc): support CP51932 (only mswin32). * test/win32ole/test_win32ole.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/win32ole/test_win32ole.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/win32ole') diff --git a/test/win32ole/test_win32ole.rb b/test/win32ole/test_win32ole.rb index 914610375c..44d9a35071 100644 --- a/test/win32ole/test_win32ole.rb +++ b/test/win32ole/test_win32ole.rb @@ -361,6 +361,30 @@ if defined?(WIN32OLE) end end + def test_cp51932 + cp = WIN32OLE.codepage + begin + obj = WIN32OLE_VARIANT.new([0x3042].pack("U*").force_encoding("UTF-8")) + # mswin32 ruby only supports CP51932 + if /mswin/ =~ RUBY_PLATFORM + begin + WIN32OLE.codepage = 51932 + rescue + end + if WIN32OLE.codepage == 51932 + assert_equal("\xA4\xA2".force_encoding("CP51932"), obj.value) + end + else + # cygwin, mingw32 ruby does not support CP51932 + assert_raise(WIN32OLERuntimeError) { + WIN32OLE.codepage = 51932 + } + end + ensure + WIN32OLE.codepage = cp + end + end + def test_s_locale assert_equal(WIN32OLE::LOCALE_SYSTEM_DEFAULT, WIN32OLE.locale) end -- cgit v1.2.3