今日の修行
% diff /Library/Perl/5.8.8/POE/Wheel/ReadLine.pm POE/Wheel/ReadLine.pm
6c6
< BEGIN { eval { require bytes } and bytes->import; }
---
> # BEGIN { eval { require bytes } and bytes->import; }
35a36
> binmode $stdin, ":utf8";
38a40
> binmode $stdout, ":utf8";
644a647
> return $_ unless $normalized_character{$_};
927a931
> use Encode;
932c936,944
< while (defined(my $raw_key = ReadKey(-1))) {
---
> my $buf = '';
> while (defined(my $tmp = ReadKey(-1))) {
> $buf .= $tmp;
> my $raw_key = Encode::decode('utf8', $buf, Encode::FB_QUIET);
> $raw_key or next;
> $buf = '';
>
> Encode::is_utf8($raw_key) or die $raw_key;
> CORE::length($raw_key) == 1 or die CORE::length($raw_key) . $raw_key;
936a949
>
1566c1579
< print _normalize($right_string);
---
> print $stdout _normalize($right_string);
-
- 後は、各文字が端末上で何byte分に展開されるかが取れれば終わりかな*3