Issue #18323 has been updated by Josh Cooper. Status changed from Duplicate to Accepted
I realize this isn't actually a dup of #20522, which is just an umbrella bug to cover all of the UTF-8 issues. In this particular case, we're writing out YAML that we can't later read back in. ---------------------------------------- Bug #18323: Windows user provider fails to create user with non-ASCII characters https://projects.puppetlabs.com/issues/18323#change-95366 * Author: Josh Cooper * Status: Accepted * Priority: Normal * Assignee: * Category: * Target version: * Affected Puppet version: 2.7.6 * Keywords: windows adsi i18n * Branch: ---------------------------------------- The windows_adsi user provider essentially does the following when creating a user: <pre> require 'Win32API' require 'win32ole' def computer_name buf = " " * 128 Win32API.new('kernel32', 'GetComputerName', ['P','P'], 'I').call(buf, buf.length.to_s) buf.unpack("A*") end conn = WIN32OLE.connect("WinNT://#{computer_name}") user = conn.Create('user', name) user.SetPassword(password) user.SetInfo </pre> On Ruby 1.8.7, this succeeds, but results in a corrupt username when using the name 'Евгений'. I think this is because ruby's implementation (win32ole.c) defaults to ANSI codepage, so internally it tries to convert MultiByteToWideChar using the wrong codepage. There is a `WIN32OLE.codepage=` method, but it only accepts a select number of options in 1.8.7. Also the `Puppet::Util::ADSI.computer_name` calls `buf.unpack('A*')` when building the ADSI connection string. This returns an array, instead of a string. In ruby 1.8.7, it automatically converts the array to a string. On Ruby 1.9.3, WIN32OLE uses the right code page, and puppet would set the username correctly, but since ruby 1.9 doesn't automatically convert the array to a string, it fails. The `buf.unpack('A*')` line should be removed as it serves no purpose. Once that is done, then things should work as expected on ruby 1.9 -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
