GeorgeK has asked for the wisdom of the Perl Monks concerning the following question:

Hi guys, Please note that I am forced to use perl 5.6.2. I have an issue with marking strings as being UTF8. In particular, I am making use of Devel::Peek to dump the variable info and see whether they are marked as UTF8. For example consider this small program that works in 5.7.3+
#!/usr/bin/env perl use strict; use warnings; use Encode; use Devel::Peek; my $a='AAA'; Dump($a); $a = decode('utf8',$a); Dump($a);
with output being
> ./utf8-1.pl SV = PV(0x92a10a0) at 0x929ee10 REFCNT = 1 FLAGS = (PADBUSY,PADMY,POK,pPOK) PV = 0x92aea88 "AAA"\0 CUR = 3 LEN = 4 SV = PV(0x92a10a0) at 0x929ee10 REFCNT = 1 FLAGS = (PADBUSY,PADMY,POK,pPOK,UTF8) PV = 0x92f76c8 "AAA"\0 [UTF8 "AAA"] CUR = 3 LEN = 4
Are you aware of a way to accomplish the same in 5.6.2? TIA, George

Replies are listed 'Best First'.
Re: Mark a string as UTF8 in 5.6.2
by ikegami (Patriarch) on Jun 24, 2011 at 20:44 UTC
    $s .= chr(0x100); chop($s);???
      Yup that did it! Unfortunately, I still need to replicate, somehow, what the decode call does to see whether my data will arrive on the correct format to the client.
      Thanks again!
      George
Re: Mark a string as UTF8 in 5.6.2
by Tux (Canon) on Jun 25, 2011 at 12:38 UTC

    I know you said you are forced to use 5.6.2, but I personally consider 5.8.4 the absolute minimum for reliable UTF-8 works. All older version will bite back in unexpected area's.


    Enjoy, Have FUN! H.Merijn
      After spending the better part of yesterday and today trying to get my data to display properly on my page, I will agree with you that 5.6.2 is hopeless!
      Thank you all!
      George
Re: Mark a string as UTF8 in 5.6.2
by Anonymous Monk on Jun 24, 2011 at 23:16 UTC
      I did try it to no avail :/
      George