janlelis/clipboard

Encoding error with Copy

nortain opened this issue · 1 comments

I was playing around with the Clipboard.copy function and tried copying the string some unicode and got this exception

Clipboard.copy("\u00AE") #=> Encoding::UndefinedConversionError: U+00AE to IBM437 in conversion from UTF-16LE to UTF-8 to IBM437

I'm still trying to determine if I can get solve this problem by forcing the encoding prior to copying the text but I figured I'd pass the word on this.

This issue can probably be closed I was able to get the copy functionality working by using
Clipboard.copy("\u00AE".force_encoding('IBM437').encode('UTF-8'))