shlomif / Clipboard

Perl / CPAN extension for copying/pasting to the system's Clipboard (X.org / Windows / Mac)
http://metacpan.org/release/Clipboard
Other
6 stars 3 forks source link

'Wide character in print' in Linux #4

Closed shawnhcorey closed 4 years ago

shawnhcorey commented 4 years ago

When using this module in Linux, copying UTF-8 strings results in a warning: Wide character in print... This can be fixed by adding a binmode command after the open in copy_to_selection.

sub copy_to_selection {
    my $self = shift;
    my ($selection, $input) = @_;
    my $cmd = '|xclip -i -selection '. $selection;
    my $r = open my $exe, $cmd or die "Couldn't run `$cmd`: $!\n";
    binmode $exe, ':encoding(UTF-8)';
    print $exe $input;
    close $exe or die "Error closing `$cmd`: $!";

    return;
}
shlomif commented 4 years ago

Should be fixed in 0.26. Thanks for the report! Let me know if and when this ticket can be closed.

shawnhcorey commented 4 years ago

Got the update. Works good. Can close this.

shlomif commented 4 years ago

Got the update. Works good. Can close this.

Thanks for the update. Closing then.