perl-unicode

Re: bytes::substr() ?

2003-08-27 09:30:07
On Wed, Aug 27, 2003 at 06:04:48PM +0200, Guido Flohr wrote:
Hi,

ed-perluni(_at_)inkdroid(_dot_)org wrote:
I'm working with a byte oriented protocol, and need to extract byte n1 
through
byte n2 from a string. 

I read this as "*character* n1 through *character* n2", right?

Alas, no -- I'm interested in byte n1 through byte n2. This is because the
protocol I am working with uses byte offsets. substr() works like a charm as
long as 1 char = 1 byte, but in utf8 it breaks down.

So given a string of utf8 data $x I want to be able to extract bytes 3 - 12 from
it...not characters :(

//Ed

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