Fix BOM and trailing null in Windows clipboard