Output string as UCS2 : Unicode « String « Perl






Output string as UCS2

   

use Unicode::String;

my $string = "This is a test\n";
my $u = Unicode::String->new($string);



# print as UCS2
print $u->ucs2;

   
    
    
  








Related examples in the same category

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