Talk:Numeric character reference

From Wikipedia, the free encyclopedia

[edit] Numeric character conversor

For usual needs, there are a "1 line code" conversor for Perl:

while (<STDIN>) {
       s/(.)/(ord($1)>127)? ('&#'.ord($1).';'): $1/ge;
       print $_;
}

(use %perl code.pl < fileIn.txt > fileOut.txt)

It converts unicode or ISO Latim to XML-compatible ASCII.