Subject: | Usage of substr($utf8_string) may abort |
Using the attached script I get:
Tcl_GetStringFromObj @ 552 not utf8
SV = PVLV(0x8170b70) at 0x813a028
REFCNT = 1
FLAGS = (PADMY,GMG,SMG,pPOK,UTF8)
IV = 0
NV = 0
PV = 0x83ac588 ".rtsrehc\374lB"\0Malformed UTF-8 character (unexpected end of
string) at /usr/perl5.8.3/lib/site_perl/5.8.3/i686-linux/Tk.pm line 247.
[UTF8 ".rtsrehc\x{2c080000}"]
CUR = 11
LEN = 13
MAGIC = 0x83aacf8
MG_VIRTUAL = &PL_vtbl_substr
MG_TYPE = PERL_MAGIC_substr(x)
TYPE = x
TARGOFF = 0
TARGLEN = 11
TARG = 0x8139fa4
SV = PV(0x83642b8) at 0x8139fa4
REFCNT = 2
FLAGS = (POK,pPOK)
PV = 0x836e608 ".rtsrehc\374lB"\0
CUR = 11
LEN = 12
Abort (core dumped)
Regards,
Slaven
use Tk;
$mw=tkinit;
$bla = ".rtsrehc\374lB";
$c=$mw->Canvas->pack;
#$c->createText(100, 100, -text => $bla); # works
$c->createText(100, 100, -text => substr($bla,0)); # does not work
MainLoop;