Charchter encoding conversion in xml file perl

esotteextethy

New Member
I am reading a text file and putting its content within a tag in an xml output file. The problem I am facing is that the input text file contains some control characters like \[code\]<96>\[/code\] or \[code\]<92>\[/code\] which cause my script to output invalid xml.How can I convert these control characters to corresponding numerical HTML entities so that there is no data loss and the resulting file is valid as well?I have tried:\[code\]perl -p -i -e 's/\x96/\&\#150\;/g; s/\x92/\&\#146\;/g;' out_xml\[/code\]But I would like to convert any control characters to HTML entities.
 
Back
Top