Beta Shell
v2.0 ยท web2.us.cloudlogin.co
[FM]
[CMD]
[PHP]
[DB]
[INFO]
[SEC]
File Manager
~
/
usr
/
local
/
share
/
perl5
/
MIME
/
Charset
Upload
5 items
Name
Size
Perms
Modified
Actions
[ .. / .. ]
Defaults.pm.sample
719 B
-r--r--r--
2017-04-06 00:46:05
Edit
Del
UTF.pm
1.16 KB
-r--r--r--
2017-04-06 00:46:05
Edit
Del
_Compat.pm
3.17 KB
-r--r--r--
2017-04-06 00:46:05
Edit
Del
Editing: UTF.pm
(1.16 KB)
Path: /usr/local/share/perl5/MIME/Charset/UTF.pm
Back
#-*- perl -*- #-*- encoding: utf-8 -*- package MIME::Charset::UTF; use strict; use Carp qw(croak); use Encode::Encoding; use vars qw(@ISA $VERSION); @ISA = qw(Encode::Encoding); $VERSION = '1.010'; __PACKAGE__->Define('x-utf16auto'); __PACKAGE__->Define('x-utf32auto'); sub perlio_ok { 0 } sub decode { my ($self, $octets, $check) = @_; if ($self->name =~ /16/) { if ($octets =~ /\A\xFE\xFF/ or $octets =~ /\A\xFF\xFE/) { return Encode::find_encoding('UTF-16')->decode($_[1], $_[2]); } else { return Encode::find_encoding('UTF-16BE')->decode($_[1], $_[2]); } } elsif ($self->name =~ /32/) { if ($octets =~ /\A\0\0\xFE\xFF/ or $octets =~ /\A\xFF\xFE\0\0/) { return Encode::find_encoding('UTF-32')->decode($_[1], $_[2]); } else { return Encode::find_encoding('UTF-32BE')->decode($_[1], $_[2]); } } else { croak 'bug in logic. Ask developer'; } } sub encode { my $self = $_[0]; if ($self->name =~ /16/) { return Encode::find_encoding('UTF-16')->encode($_[1], $_[2]); } elsif ($self->name =~ /32/) { return Encode::find_encoding('UTF-32')->encode($_[1], $_[2]); } else { croak 'bug in logic. Ask developer'; } }