Patched clipboard functions for proper utf-8 handling