Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/ffi/win32/extensions.rb
Instance Method Summary collapse
-
#wincode ⇒ Object
Convenience method for converting strings to UTF-16LE for wide character functions that require it.
-
#wstrip ⇒ Object
Read a wide character string up until the first double null, and delete any remaining null characters.
Instance Method Details
#wincode ⇒ Object
Convenience method for converting strings to UTF-16LE for wide character functions that require it.
68 69 70 |
# File 'lib/ffi/win32/extensions.rb', line 68 def wincode (self.tr(File::SEPARATOR, File::ALT_SEPARATOR) + 0.chr).encode('UTF-16LE') end |
#wstrip ⇒ Object
Read a wide character string up until the first double null, and delete any remaining null characters.
75 76 77 78 |
# File 'lib/ffi/win32/extensions.rb', line 75 def wstrip self.force_encoding('UTF-16LE').encode('UTF-8', :invalid=>:replace, :undef=>:replace). split("\x00")[0].encode(Encoding.default_external) end |