utf8 encode : Unicode « String « Perl






utf8 encode

   

#!/usr/bin/perl


my $Psi=chr(0x471);
print "Wide-character length: ",length($Psi),"\n";
print "First character code : ",ord(substr $Psi,0,1),"\n";
utf8::encode $Psi;
print "Byte length: ",length($Psi),"\n";
print "First character code : ",ord(substr $Psi,0,1),"\n";
utf8::decode $Psi;
print "Wide-character again: ",length($Psi),"\n";
print "First character code : ",ord(substr $Psi,0,1),"\n";

   
    
    
  








Related examples in the same category

1.Output string as UCS2
2.Output string as utf8
3.utf8 Composite Character Classes
4.utf8 encoding
5.binmode STDOUT,":utf8";
6.A stringful of 16-bit characters