Hi Monks,
I have a lot of HTML files with Numeric Character Reference (NCR) and Character Entity References (CER) presentation like:
cách bạn đặt
I would like to convert all into UTF-8 characters. I'm a Perl's newbie so I try a stupid method (for NCR decimal < 255 and CER presentation only):
my %ARR = (
'acirc' => 'â', 'atilde' => 'ã', 'auml' => 'ä',
'226' => 'â', '227' => 'ã', '228' => 'ä'
);
while(<>){
s/&#?([^;]+);/$ARR{$1}/g;
print $_;
}
exit;
I'm sure that there is better way to do that. So I'm there and I would like to learn from you all.
Thank you in advance,