1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

WIN32OLE.codepage= accepts installed codepage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
suke 2007-01-20 12:12:36 +00:00
parent 75ce70d353
commit 3b5dbc4b06
3 changed files with 67 additions and 20 deletions

View file

@ -1,5 +1,4 @@
#
#
begin
require 'win32ole'
@ -273,6 +272,22 @@ if defined?(WIN32OLE)
str = ifs.read
}
assert_equal("\343\201", str)
# This test fail if codepage 20932 (euc) is not installed.
begin
WIN32OLE.codepage = 20932
rescue WIN32OLERuntimeError
end
if (WIN32OLE.codepage == 20932)
file = fso.opentextfile(fname, 2, true)
file.write [164, 162].pack("c*")
file.close
open(fname) {|ifs|
str = ifs.read
}
assert_equal("\202\240", str)
end
ensure
WIN32OLE.codepage = WIN32OLE::CP_ACP
if (File.exist?(fname))