how do I encode UTF-8 characters into numeric character reference format (in Perl)?

$ echo 'foobar' | perl -pe "s/./ sprintf '&#x%04x;', ord($&) /ge"

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.