| Class | Ole::Types::Lpwstr |
| In: |
lib/ole/types/base.rb
|
| Parent: | String |
| FROM_UTF16 | = | Iconv.new 'utf-8', 'utf-16le' |
| TO_UTF16 | = | Iconv.new 'utf-16le', 'utf-8' |
# 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