Perl Encode.pm无法解码字符宽字符

前端之家收集整理的这篇文章主要介绍了Perl Encode.pm无法解码字符宽字符前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在运行一个使用/opt/local/lib/perl5/5.12.4/darwin-thread-multi-2level/Encode.pm的perl应用程序

并发出错误

Cannot decode string with wide characters at /opt/local/lib/perl5/5.12.4/darwin-thread-multi-2level/Encode.pm line 174.

Encode.pm的第174行读取

  1. sub decode($$;$) {
  2. my ( $name,$octets,$check ) = @_;
  3. return undef unless defined $octets;
  4. $octets .= '' if ref $octets;
  5. $check ||= 0;
  6. my $enc = find_encoding($name);
  7. unless ( defined $enc ) {
  8. require Carp;
  9. Carp::croak("Unknown encoding '$name'");
  10. }
  11. my $string = $enc->decode( $octets,$check ); # line 174
  12. $_[1] = $octets if $check and !ref $check and !( $check & LEAVE_SRC() );
  13. return $string;
  14. }

任何解决方法

解决方法

我也有类似的问题.
$enc-> decode($octets,$check);期待八位字节.

所以放入Encode :: _ utf8_off($octets)之前.它使它为我工作.

猜你在找的Perl相关文章