Stripping characters from windows clipboard with win32clipboard from excel

Dave Angel davea at davea.name
Thu Sep 19 15:58:24 EDT 2013


On 19/9/2013 11:53, Neil Cerutti wrote:

> On 2013-09-18, Dave Angel <davea at davea.name> wrote:
>> On 18/9/2013 17:40, Neil Hodgson wrote:
>>
>>> Dave Angel:
>>>
>>>> So is the bug in Excel, in Windows, or in the Python library?  Somebody
>>>> is falling down on the job;  if Windows defines the string as ending at
>>>> the first null, then the Python interface should use that when defining
>>>> the text defined with CF_UNICODETEXT.
>>>
>>>     Everything is performing correctly. win32clipboard is low-level 
>>> direct access to the Win32 clipboard API. A higher level API which is 
>>> more easily used from Python could be defined on top of this if anyone 
>>> was motivated.
>>>
>>>     Neil
>>
>> Clearly you miss the point.  If the clipboard API is defined to
>> return a null-terminated string, then the problem is in the
>> Python library which doesn't do a strlen() (or the
>> wide-character equivalent;  I forget its name) on the results.
>
> Python can't really know if you're pasting text or a screenshot
> or what.
>

 CF_UNICODETEXT  gives it a pretty good clue.

But random832 has already mentioned that it's an ill-specified Windows
interface;  different programs deal with it differently.  No way that a
the Python library should deal with that.

-- 
DaveA





More information about the Python-list mailing list