mhammond / pywin32

Python for Windows (pywin32) Extensions
4.9k stars 783 forks source link

Clipboard: Remove NUL char addition for non text formats #2184

Closed CristiFati closed 3 months ago

CristiFati commented 4 months ago

Proposed fix for #2096.

While on the subject, since SetClipboardText is just a convenience wrapper (over SetClipboardData) for texts, wouldn't make sense to drop the 2nd argument (format) and rely solely on the data? The functionality that would no longer work is the one marked with @TODO in the test (cause the other "cross" combination fails at conversion)? Or (since there might be other software already passing it) just leave it there but ignore it?

mhammond commented 3 months ago

wouldn't make sense to drop the 2nd argument (format) and rely solely on the data?

I guess that wouldn't work for CF_OEMTEXT though, right? But I guess it makes sense to have this param default to (say) None and use the data in that case to choose between the other 2 text formats?