Class Ole::Types::Lpwstr
In: lib/ole/types/base.rb
Parent: String
String Data Lpstr Clsid Lpwstr Section Enumerable DateTime FileTime Constants Variant::Constants Storage\n[lib/ole/storage/base.rb\nlib/ole/storage/file_system.rb\nlib/ole/storage/meta_data.rb] PropertySet lib/ole/storage/file_system.rb lib/ole/types/property_set.rb lib/ole/types/base.rb Constants Constants Variant Types Ole dot/m_9_0.png

for VT_LPWSTR

Methods

dump   load  

Constants

FROM_UTF16 = Iconv.new 'utf-8', 'utf-16le'
TO_UTF16 = Iconv.new 'utf-16le', 'utf-8'

Public Class methods

[Source]

    # File lib/ole/types/base.rb, line 47
47:                         def self.dump str
48:                                 # need to append nulls?
49:                                 data = TO_UTF16.iconv str
50:                                 # not sure if this is the recommended way to do it, but I want to treat
51:                                 # the resulting utf16 data as regular bytes, not characters.
52:                                 data.force_encoding Encoding::US_ASCII if data.respond_to? :encoding
53:                                 data
54:                         end

[Source]

    # File lib/ole/types/base.rb, line 43
43:                         def self.load str
44:                                 new FROM_UTF16.iconv(str).chomp(0.chr)
45:                         end

[Validate]