From djberg96 at gmail.com Thu Jul 14 11:13:23 2011 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 14 Jul 2011 09:13:23 -0600 Subject: [Win32utils-devel] Fwd: [win32-clipboard] ArgumentError: invalid byte sequence in US-ASCII when copying from clipboard (#1) Message-ID: <4E1F0793.5030003@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: ```ruby 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 From phasis at gmail.com Fri Jul 15 21:07:04 2011 From: phasis at gmail.com (Heesob Park) Date: Sat, 16 Jul 2011 10:07:04 +0900 Subject: [Win32utils-devel] Fwd: [win32-clipboard] ArgumentError: invalid byte sequence in US-ASCII when copying from clipboard (#1) In-Reply-To: <4E1F0793.5030003@gmail.com> References: <4E1F0793.5030003@gmail.com> Message-ID: Hi, 2011/7/15 Daniel Berger > 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: > > ```ruby > 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") Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: From djberg96 at gmail.com Mon Jul 18 02:48:18 2011 From: djberg96 at gmail.com (Daniel Berger) Date: Mon, 18 Jul 2011 01:48:18 -0500 Subject: [Win32utils-devel] Fwd: [win32-clipboard] ArgumentError: invalid byte sequence in US-ASCII when copying from clipboard (#1) In-Reply-To: References: <4E1F0793.5030003@gmail.com> Message-ID: On Fri, Jul 15, 2011 at 8:07 PM, Heesob Park wrote: > Hi, > > 2011/7/15 Daniel Berger >> >> 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: >> >> ```ruby >> 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? Regards, Dan