Commit | Line | Data |
18586f54 |
1 | package Encode::utf8; |
2 | use strict; |
d6b7ef86 |
3 | our $VERSION = do { my @r = (q$Revision: 0.92 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; |
4 | |
18586f54 |
5 | use base 'Encode::Encoding'; |
6 | # package to allow long-hand |
7 | # $octets = encode( utf8 => $string ); |
8 | # |
9 | |
10 | __PACKAGE__->Define(qw(UTF-8 utf8)); |
11 | |
12 | sub decode |
13 | { |
14 | my ($obj,$octets,$chk) = @_; |
15 | my $str = Encode::decode_utf8($octets); |
16 | if (defined $str) |
17 | { |
18 | $_[1] = '' if $chk; |
19 | return $str; |
20 | } |
21 | return undef; |
22 | } |
23 | |
24 | sub encode |
25 | { |
26 | my ($obj,$string,$chk) = @_; |
27 | my $octets = Encode::encode_utf8($string); |
28 | $_[1] = '' if $chk; |
29 | return $octets; |
30 | } |
31 | 1; |
32 | __END__ |