in reply to Re^2: Why won't Perl convert (Latin1 | ISO-8859-1) to (UTF-8 | utf8)?
in thread Why won't Perl convert (Latin1 | ISO-8859-1) to (UTF-8 | utf8)?
Thanks for your complimentary remarks — they are appreciated.
piconv does use Encode. It's also relatively short: if you ignore the option handling, POD, etc., you're left with probably less than 100 lines of code. So, if you wanted to use that as a starting point to roll your own version, I don't imagine it would be an overwhelmingly difficult task. However, having said that, if this is just a one-off exercise, perhaps something along these lines would suffice:
$ for i in latin/*.html; do > piconv -f ISO-8859-1 -t utf8 $i | \ > perl -pe 's/((?>charset|encoding)=)iso-8859-1/${1}utf-8/gi' - \ > > utf8/`basename $i` > done
-- Ken
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Why won't Perl convert (Latin1 | ISO-8859-1) to (UTF-8 | utf8)?
by taint (Chaplain) on Jun 07, 2013 at 21:04 UTC |
In Section
Seekers of Perl Wisdom