in reply to Re: converting utf-8 to ISO-8859-1
in thread converting utf-8 (entities?) to ISO-8859-1

You're right about converting non-ascii characters to numeric references. As for making sure that perl interprets text data from the database as utf8, the Encode module would suffice:
use Encode; # ... get database text into $text and then: $text = decode( 'utf8', $text );
Assuming that the text data drawn from the database really is valid utf8, the "decode" call will set the utf8-flag, and then the regex substitution you showed will work fine.

Replies are listed 'Best First'.
Re^3: converting utf-8 to ISO-8859-1
by bart (Canon) on Apr 22, 2005 at 07:19 UTC
    Yes, but Encode comes with 5.8.x only. Nothing comparable exists for earlier perls. My solution will work for 5.6.x too.

    Earlier perls are UTF-8-unaware, so for those, a different solution has to be handcrafted, still.