Remove HanZi and 7bit-kr, from SADAHIRO Tomoyuki.
[p5sagit/p5-mst-13.2.git] / ext / Encode / lib / Encode / Unicode.pm
1 package Encoding::Unicode;
2 use strict;
3 our $VERSION = do {my @r=(q$Revision: 0.30 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r};
4 use base 'Encode::Encoding';
5
6 __PACKAGE__->Define('Unicode') unless ord('A') == 65;
7
8 sub decode
9 {
10     my ($obj,$str,$chk) = @_;
11     my $res = '';
12     for (my $i = 0; $i < length($str); $i++)
13     {
14         $res .= chr(utf8::unicode_to_native(ord(substr($str,$i,1))));
15     }
16     $_[1] = '' if $chk;
17     return $res;
18 }
19
20 sub encode
21 {
22     my ($obj,$str,$chk) = @_;
23     my $res = '';
24     for (my $i = 0; $i < length($str); $i++)
25     {
26         $res .= chr(utf8::native_to_unicode(ord(substr($str,$i,1))));
27     }
28     $_[1] = '' if $chk;
29     return $res;
30 }
31
32 1;
33 __END__