develooper Front page | perl.perl5.porters | Postings from January 2020

Re: ???strict??? strings?

Thread Previous | Thread Next
From:
Tony Cook
Date:
January 6, 2020 03:09
Subject:
Re: ???strict??? strings?
Message ID:
20200106030913.GC5228@mars.tony.develop-help.com
On Sun, Jan 05, 2020 at 09:40:49PM -0500, Felipe Gasper wrote:
> 
> >> The UTF8 flag doesn't mark a SV (with PV) as a character string.  A SV
> >> (with PV) without the UTF8 flag may be a character string.
> > 
> > Just to clarify: such a “character string” can only contain code points 0-255, right? Whereas a character string *with* the UTF8 flag may contain any code point?
> 
> Follow-up question: does any binary/text-aware encoder (CBOR, Sereal, etc.) ever encode a non-UTF8-flag SV as text rather than binary?

I don't know, and it's irrelevant.

That isn't the purpose of the SVfUTF8 flag.

Code that uses the SVfUTF8 flag to decide whether a string should be
interpreted as octets or characters is broken.

The developer should decide this when they define the interface to a
function/class, the same as when you decide a parameter is a name or
an address.

Tony

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