Merge in changes to clipboard handling code from trunk.
The merged logic is not correct for Unicode, because it doesn't insert a BOM to the beginning of the clipboard file. This will be fixed in a subsequent commit.
Authored by: david_costanzo 2019-12-29
Parent: [r5082]
Child: [r5084]