Using the more general GetAs method, the data is returned in the expected underlying Windows representation, but it is truncated at the first 0 byte! If it returned the contents properly as a buffer, I could then process it into a Perl-friendly format, but since it's not returning the data properly (up to the stated length complete with embedded nul's), it's kind of stuck.
Win32::Clipboard is written in XS so the module isn't easily updated. Is there any plans to extend it, or does anyone have a solution already?
${^WIDE_SYSTEM_CALLS}=1; use strict; use warnings; use utf8; use Win32::Clipboard; sub dumpstring { my ($caption, $x)= @_; my ($outstring, $out); open $out, ">", \$outstring or die; print "$caption: ($x) "; while ($x =~ /./g) { printf {$out} "%x ", ord($&); } return $outstring; } my $CLIP = Win32::Clipboard(); my $x= $CLIP->Get(); print dumpstring ("ANSI contents", $x), "\n"; my @formats= $CLIP->EnumFormats(); print "Formats: @formats\n"; $x= $CLIP->GetAs (13); print dumpstring ("GetAs Unicode contents", $x), "\n";
In reply to Win32::Clipboard and Unicode by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |