Changeset 4865
- Timestamp:
- 01/18/08 14:24:41 (5 years ago)
- Location:
- lang/perl/autobox-Encode/trunk
- Files:
-
- 2 modified
-
lib/autobox/Encode.pm (modified) (3 diffs)
-
t/01_simple.t (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/autobox-Encode/trunk/lib/autobox/Encode.pm
r4777 r4865 1 1 package autobox::Encode; 2 2 use strict; 3 use charnames (); 3 4 use warnings; 4 5 use autobox; … … 12 13 sub is_utf8 { Encode::is_utf8($_[0]) } 13 14 sub from_to { Encode::from_to($_[0], $_[1], $_[2]); $_[0] } 15 16 sub charname { 17 my $string = shift; 18 join '', map charnames::viacode(ord), split //, $string; 19 } 14 20 15 21 1; … … 27 33 28 34 "Foo"->decode('utf-8')->encode('utf-8') 35 36 my $latin1_bytes = ...; 37 my $utf8_bytes = $latin1_bytes->from_to('latin-1' => 'utf-8'); 38 39 "\x{1234}"->charname; # "ETHIOPIC SYLLABLE SEE" 29 40 30 41 =head1 DESCRIPTION -
lang/perl/autobox-Encode/trunk/t/01_simple.t
r4777 r4865 4 4 use autobox::Encode; 5 5 use Encode (); 6 use Test::More tests => 7;6 use Test::More tests => 8; 7 7 8 8 ok Encode::is_utf8('あいうえお'->decode('utf-8')); … … 15 15 my $x = 'あいうえお'; 16 16 is uc(unpack "H*", $x->from_to('utf-8' => 'euc-jp')), "A4A2A4A4A4A6A4A8A4AA"; 17 18 is "\x{1234}"->charname, "ETHIOPIC SYLLABLE SEE";
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)