develooper Front page | perl.perl5.porters | Postings from September 2013

Re: [perl #113994] [META] seek and tell operate on bytes

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
September 6, 2013 01:36
Subject:
Re: [perl #113994] [META] seek and tell operate on bytes
Message ID:
20130906013551.GA23519@cancer.codesimply.com
* Tony Cook <tony@develop-help.com> [2012-07-04T21:03:01]
> On Wed, Jul 04, 2012 at 04:29:48PM -0500, Jesse Luehrs wrote:
> > I don't personally have any ideas, there just seemed to be a lot of
> > tickets related to this issue, and it wasn't clear that they should all
> > be immediately closed as wontfix. If we end up making that decision,
> > this will at least make it easier to clear out the tracker.
> 
> I think they should be wontfix.

I agree.

I have a filehandle with encoding(utf-8).  It is a sequence of two-byte
sequences.  I seek to the second byte of a pair and read.  What should happen?

In UTF-8, there is no ambiguity.  I have clearly tried to read mid-sequence.
It could die or it could return a replacement character, rewind, or skip ahead,
and warn while doing any of those.  The layer could allow picking from these,
and I'm usually a fan of "when in doubt, die."  But anyway, there's no
ambiguity, so we're good.

My understanding is that there exist encodings where we cannot so easily
determine our position (whether we are mid-sequence or not).  I don't know of
any off hand, though.  What about those?  I really think the answer is going to
be along the lines of "the layer can try to help tell you that you messed up,
but don't *do* that.

-- 
rjbs

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About