Daniel Berger
2009-Aug-02 13:33 UTC
[Win32utils-devel] win32-security, 1.9.x, encoding issue?
Hi,
Windows Vista Home Premium
ruby 1.9.2dev (2009-07-18 trunk 24186) [i386-mswin32_90]
I noticed there was an ordinal bug in win32-security and Ruby 1.9.x. I fixed
those easily enough, but now we''re left with this:
1) Error:
test_string_to_sid(TC_Win32_Security_Sid):
ArgumentError: invalid byte sequence in US-ASCII
c:/Users/djberge/workspace/win32-security/lib/win32/security/sid.rb:111:in
`strip''
c:/Users/djberge/workspace/win32-security/lib/win32/security/sid.rb:111:in
`string_to_sid''
test/test_sid.rb:62:in `test_string_to_sid''
Where line 111 is the last line of this:
def self.string_to_sid(string)
sid_buf = 0.chr * 80
string_addr =
[string].pack(''p*'').unpack(''L'')[0]
unless ConvertStringSidToSid(string_addr, sid_buf)
raise Error, get_last_error
end
sid_buf.strip
end
I searched on the web but I wasn''t really sure what the best or correct
solution was. I really hope we don''t have to mess around with file
encodings.
Regards,
Dan
Heesob Park
2009-Aug-03 01:00 UTC
[Win32utils-devel] win32-security, 1.9.x, encoding issue?
Hi, 2009/8/2 Daniel Berger <djberg96 at gmail.com>:> Hi, > > Windows Vista Home Premium > ruby 1.9.2dev (2009-07-18 trunk 24186) [i386-mswin32_90] > > I noticed there was an ordinal bug in win32-security and Ruby 1.9.x. I fixed > those easily enough, but now we''re left with this: > > ?1) Error: > test_string_to_sid(TC_Win32_Security_Sid): > ArgumentError: invalid byte sequence in US-ASCII > > c:/Users/djberge/workspace/win32-security/lib/win32/security/sid.rb:111:in > `strip'' > > c:/Users/djberge/workspace/win32-security/lib/win32/security/sid.rb:111:in > `string_to_sid'' > ? ?test/test_sid.rb:62:in `test_string_to_sid'' > > Where line 111 is the last line of this: > > def self.string_to_sid(string) > ? sid_buf = 0.chr * 80 > ? string_addr = [string].pack(''p*'').unpack(''L'')[0] > > ? unless ConvertStringSidToSid(string_addr, sid_buf) > ? ? ?raise Error, get_last_error > ? end > > ? sid_buf.strip > end > > I searched on the web but I wasn''t really sure what the best or correct > solution was. I really hope we don''t have to mess around with file > encodings. >Either sid_buf = (0.chr * 80).force_encoding(''ASCII-8BIT'') or sid_buf.force_encoding(''ASCII-8BIT'').strip And it means 1.9.x source code is not compatible with 1.8.x. Refer to http://blog.grayproductions.net/articles/ruby_19s_string Regards, Park Heesob
Daniel Berger
2009-Aug-03 14:03 UTC
[Win32utils-devel] win32-security, 1.9.x, encoding issue?
On Sun, Aug 2, 2009 at 7:00 PM, Heesob Park<phasis at gmail.com> wrote:> Hi, > > 2009/8/2 Daniel Berger <djberg96 at gmail.com>: >> Hi, >> >> Windows Vista Home Premium >> ruby 1.9.2dev (2009-07-18 trunk 24186) [i386-mswin32_90] >> >> I noticed there was an ordinal bug in win32-security and Ruby 1.9.x. I fixed >> those easily enough, but now we''re left with this: >> >> ?1) Error: >> test_string_to_sid(TC_Win32_Security_Sid): >> ArgumentError: invalid byte sequence in US-ASCII >> >> c:/Users/djberge/workspace/win32-security/lib/win32/security/sid.rb:111:in >> `strip'' >> >> c:/Users/djberge/workspace/win32-security/lib/win32/security/sid.rb:111:in >> `string_to_sid'' >> ? ?test/test_sid.rb:62:in `test_string_to_sid'' >> >> Where line 111 is the last line of this: >> >> def self.string_to_sid(string) >> ? sid_buf = 0.chr * 80 >> ? string_addr = [string].pack(''p*'').unpack(''L'')[0] >> >> ? unless ConvertStringSidToSid(string_addr, sid_buf) >> ? ? ?raise Error, get_last_error >> ? end >> >> ? sid_buf.strip >> end >> >> I searched on the web but I wasn''t really sure what the best or correct >> solution was. I really hope we don''t have to mess around with file >> encodings. >> > Either > sid_buf = (0.chr * 80).force_encoding(''ASCII-8BIT'') > or > sid_buf.force_encoding(''ASCII-8BIT'').strip > > And it means 1.9.x source code is not compatible with 1.8.x. > > Refer to http://blog.grayproductions.net/articles/ruby_19s_stringThanks. Fixed, updated and released. Regards, Dan