John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:
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";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::Clipboard and Unicode
by tye (Sage) on Apr 22, 2003 at 18:05 UTC | |
by John M. Dlugosz (Monsignor) on Apr 22, 2003 at 19:38 UTC | |
by tye (Sage) on Apr 22, 2003 at 20:56 UTC | |
by John M. Dlugosz (Monsignor) on Apr 22, 2003 at 21:14 UTC | |
by John M. Dlugosz (Monsignor) on Apr 22, 2003 at 20:35 UTC |