On Wed, 10 Sep 2003 08:33:03 +0100, Steve Hay wrote:

>And when I retrieve the data (again 
>without conversion) I just get octet sequences into my Perl scalars - 
>not flagged, UTF-8 character strings as I would like.

If you're *sure* that this is UTF-8, only perl doesn't flag it as such,
you can set the flag yourself. In perl 5.8.x, you can use the Encode
module, one of the functions documented near the bottom, here the
_utf8_on(STRING). That's an inplace modifying function, so you use it
like

        _utf8_on($string_that_should_be_utf8);

For perl 5.6.x (and likely for 5.8 too), you can achieve the same effect
by using pack() this way:

        $flagged_as_utf8 = pack "U0a*", $string_that_should_be_utf8;


Earlier perls than 5.6 don't have this UTF8 flag, nor do they accept the
"U" template.

-- 
        Bart.

Reply via email to