[Win32utils-devel] [ win32utils-Bugs-20722 ]Windows::Error.get_last_error only returns the firstcharacter (PATCH)

Berger, Daniel Daniel.Berger at qwest.com
Thu Jun 19 16:03:48 EDT 2008


Responding to myself here...

> > W functions accept/return UTF16 not UTF8, which breaks the 
> rest of the 
> > win32-* modules hard, as the bug above exhibits.
> >  For example, Win32::Events are now created by passing UTF8 Ruby 
> > string data to an interface expecting UTF16 (see the name 
> parameter).
> >
> > Setting $KCODE to UTF8 should not change the interface of these 
> > functions, as it breaks unrelated client code.  As it stands 'W' 
> > functions always require special conversion handling, and should be 
> > non-default.
> Ow.
> Well, I _did_ ask about this when I first implemented it. I 
> guess it wasn't such a good idea after all.
> Suggestions? Fixable? Or remove it completely?

Actually, I don't know that I agree with John (the OP). I think it just
goes with the territory that if you're going to use $KCODE/UTF8 then you
have to deal with the wide character conversions on your end.

That being said, I can't say that I've tested many of our libraries with
$KCODE set to see if they work as expected.

As for get_last_error, I think it just requires this change:

- buf.split(0.chr).first.chomp rescue 'Unknown error'
+ buf.split(0.chr).join[ /^[^\0\r\n]*/ ] rescue 'Unknown error'




This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.

More information about the win32utils-devel mailing list