Fix clipboard device code so it works identically under non-wide-char platforms