Yuya Kato
yuyak****@gmail*****
2006年 6月 2日 (金) 09:49:26 JST
Yuyaです。 > というか、UTF-8からUTF-16への変換はpack/unpackだけでできます。 > Little endian: > $ ruby -e 'p (ARGV[0]+"\0").unpack("U*").pack("v*")' Comments > "C\000o\000m\000m\000e\000n\000t\000s\000\000\000" おぉ、そうでしたか。日本語も全然大丈夫ですね。 適用しました。ありがとうございます。 Yuya. Index: lib/exerb/resource/version_info.rb =================================================================== RCS file: /cvsroot/exerb/exerb/lib/exerb/resource/version_info.rb,v retrieving revision 1.14 diff -u -r1.14 version_info.rb --- lib/exerb/resource/version_info.rb 1 Jun 2006 08:14:51 -0000 1.14 +++ lib/exerb/resource/version_info.rb 2 Jun 2006 00:47:22 -0000 @@ -3,7 +3,6 @@ # $Id: version_info.rb,v 1.14 2006/06/01 08:14:51 yuya Exp $ #==============================================================================# -require 'iconv' require 'exerb/utility' require 'exerb/resource/base' require 'exerb/win32/const/resource' @@ -116,7 +115,7 @@ block = Exerb::Win32::Struct::VersionInfoBlock.new block.type = @type - block.key = Iconv.conv("UTF-16LE", "UTF-8", @key) + block.key =****@key*****("U*").pack("v*") # UTF-8 to UTF-16LE block.data = @value block.value_length = (@unicode ? @value.size / 2 : @value.size) block.total_length = block.pack.size + packed_children.size @@ -145,7 +144,7 @@ class BlockType1String < BlockType1 def initialize(key, value) - super(key, Iconv.conv("UTF-16LE", "UTF-8", value.to_s) + "\0\0", true) + super(key, value.to_s.unpack("U*").pack("v*") + "\0\0", true) # UTF-8 to UTF-16LE end end # BlockType1String