From a848fb26b7623add9d6770f86076b42822ee24ab Mon Sep 17 00:00:00 2001 From: Bosko Ivanisevic Date: Tue, 26 Jun 2012 13:06:38 +0200 Subject: [PATCH] FileSystemObject does not support UTF-8 FSO is limited to ANSI and UTF-16LE so there is no point trying to write string encoded in any other way. --- test/win32ole/test_win32ole.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/win32ole/test_win32ole.rb b/test/win32ole/test_win32ole.rb index 8d72272..4abfe31 100644 --- a/test/win32ole/test_win32ole.rb +++ b/test/win32ole/test_win32ole.rb @@ -352,7 +352,7 @@ if defined?(WIN32OLE) WIN32OLE.codepage = cp file = fso.opentextfile(fname, 2, true) begin - file.write [0x3042].pack("U*").force_encoding("UTF-8") + file.write [0x3042].pack("U*").force_encoding("UTF-16") ensure file.close end @@ -360,7 +360,7 @@ if defined?(WIN32OLE) open(fname, "r:ascii-8bit") {|ifs| str = ifs.read } - assert_equal("\202\240", str) + assert_equal("\343\201\202", str) # This test fail if codepage 20932 (euc) is not installed. begin @@ -371,14 +371,14 @@ if defined?(WIN32OLE) WIN32OLE.codepage = cp file = fso.opentextfile(fname, 2, true) begin - file.write [164, 162].pack("c*").force_encoding("EUC-JP") + file.write [164, 162].pack("c*").force_encoding("UTF-16") ensure file.close end open(fname, "r:ascii-8bit") {|ifs| str = ifs.read } - assert_equal("\202\240", str) + assert_equal("\244\242", str) end ensure -- 1.7.10.msysgit.1