[Win32utils-devel] Fwd: [win32-clipboard] ArgumentError: invalid byte sequence in US-ASCII when copying from clipboard (#1)
djberg96 at gmail.com
Mon Jul 18 02:48:18 EDT 2011
On Fri, Jul 15, 2011 at 8:07 PM, Heesob Park <phasis at gmail.com> wrote:
> 2011/7/15 Daniel Berger <djberg96 at gmail.com>
>> Bug posted by Max Mitchell on github for win32-clipboard. Suggestions?
>> If I have the following copied into my Windows clipboard: `Hello world,
>> £12 is the cost` and I try to access the clipboard:
>> require 'rubygems'
>> require 'win32/clipboard'
>> include Win32
>> c = Clipboard.data
>> ... I get an `ArgumentError: invalid byte sequence in US-ASCII` from line
>> 123 in `clipboard.rb` caused by using the pound symbol. If I try force the
>> clipboard to read as Unicode it gives the same error. Is there a way to read
>> in these characters/the full clipboard?
>> I'm using the following:
>> * Windows XP
>> * Ruby 1.9.2p180 (2011-02-18)
>> * win32/clipboard 0.5.2
> I think the line # 123 of clipboard.rb
> clip_data = clip_data[ /^[^\0]*/ ]
> should be replaced with
> clip_data = clip_data.chomp("\x00")
I tried that, but it seemed to cause other test failures. I did update
the test file to explicitly set the encoding to utf-8. Perhaps that
was a mistake?
More information about the win32utils-devel