# File lib/facter/util/windows/api_types.rb, line 25 def self.read_wide_string(ffi_pointer, char_length, dst_encoding = Encoding::UTF_8) # char_length is number of wide chars (typically excluding NULLs), *not* bytes str = ffi_pointer.get_bytes(0, char_length * 2).force_encoding('UTF-16LE') str.encode(dst_encoding) end