User:Spundun/Perl Script to Convert Utf-8 Characters to HTML Entities
From વિકિપીડિયા
#!/usr/bin/perl -w
use HTML::Entities;
binmode (STDIN, ":utf8");
while(<>){
$string=(encode_entities($_));
foreach $char (split(/;/,$string)){
($chars,$hex) = split(/&#x/,$char);
print $chars;
if ($hex){
length($hex) == 2 or length($hex)==4 or length($hex)==6 or $hex = "0$hex";
print "&#x$hex;";
}
}
}

