http://www.perlmonks.org?node_id=1037528


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
    Greetings kcott, and thanks for your reply.

    Indeed. That does do the trick!
    Thanks!
    I sure wish I was as well versed in Perl as you are. But I'm afraid I've got a ways to go yet. :(

    As always, very grateful for all your time, and consideration.

    --chris

    #!/usr/bin/perl -Tw
    use perl::always;
    my $perl_version = "5.12.4";
    print $perl_version;