From 45d70517966b5688d1148f9b59a15865e07abe1c Mon Sep 17 00:00:00 2001 From: Hiroshi Shirosaki Date: Fri, 29 Jun 2012 20:46:48 +0900 Subject: [PATCH] Use UTF-16 String instead of UTF-8 UTF-8 String causes a test failure on Windows 7 Japanese version. Instead using UTF-16LE String works fine. OpenTextFile Method seems to change data of UTF-8 String. --- test/win32ole/test_win32ole.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/win32ole/test_win32ole.rb b/test/win32ole/test_win32ole.rb index 4abfe31..5fbfbde 100644 --- a/test/win32ole/test_win32ole.rb +++ b/test/win32ole/test_win32ole.rb @@ -351,8 +351,9 @@ if defined?(WIN32OLE) WIN32OLE.codepage = cp file = fso.opentextfile(fname, 2, true) + test_str = [0x3042].pack("U*").encode("UTF-16LE") begin - file.write [0x3042].pack("U*").force_encoding("UTF-16") + file.write test_str.force_encoding("UTF-16") ensure file.close end @@ -360,7 +361,7 @@ if defined?(WIN32OLE) open(fname, "r:ascii-8bit") {|ifs| str = ifs.read } - assert_equal("\343\201\202", str) + assert_equal(test_str.force_encoding("ascii-8bit"), str) # This test fail if codepage 20932 (euc) is not installed. begin -- 1.7.11.msysgit.0