diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-05-08 08:37:10 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-05-15 08:51:18 -0700 |
commit | 1990732da929e288b5f4ff309a5273a606dfa3bc (patch) | |
tree | ef5ca1e1c1d7bae9157fc0914aa6d0519eea0f4e /lib/chef/win32/api | |
parent | 4f1c79cb4f6de820d2bb29ea1cb5e3adf914c1ec (diff) | |
download | chef-1990732da929e288b5f4ff309a5273a606dfa3bc.tar.gz |
Empty strings should be able to be converted into wide strings
Diffstat (limited to 'lib/chef/win32/api')
-rw-r--r-- | lib/chef/win32/api/unicode.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/win32/api/unicode.rb b/lib/chef/win32/api/unicode.rb index 0b2cb09a6b..2e3a599f0a 100644 --- a/lib/chef/win32/api/unicode.rb +++ b/lib/chef/win32/api/unicode.rb @@ -139,7 +139,7 @@ int WideCharToMultiByte( ustring = (ustring + "").force_encoding('UTF-8') if ustring.respond_to?(:force_encoding) && ustring.encoding.name != "UTF-8" # ensure we have the double-null termination Windows Wide likes - ustring = ustring + "\000\000" if ustring[-1].chr != "\000" + ustring = ustring + "\000\000" if ustring.length == 0 or ustring[-1].chr != "\000" # encode it all as UTF-16LE AKA Windows Wide Character AKA Windows Unicode ustring = begin |