perl-unicode

Re: bytes::substr() ?

2003-08-27 10:30:07
Hi,

ed-perluni(_at_)inkdroid(_dot_)org wrote:
So given a string of utf8 data $x I want to be able to extract bytes 3 - 12 from
it...not characters :(

Then

        Encode::_utf8_off ($bytes);

should do the job for you; it should force byte semantics on the stream and change the behavior of substr(). Alternatively (w/o Encode) you could use unpack() with "C*" as the template, convert the string to a list, splice it, and then join('') the resulting list.

Ciao

Guido
--
Imperia AG, Development
Leyboldstr. 10 - D-50354 Hürth - http://www.imperia.de/

<Prev in Thread] Current Thread [Next in Thread>