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

Re: [perl #56444] (5.12 blocker) delayed interpolation of \N{...}charnames escapes in regexes in perl 5.9.x and later causes breakage

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
January 25, 2010 09:03
Subject:
Re: [perl #56444] (5.12 blocker) delayed interpolation of \N{...}charnames escapes in regexes in perl 5.9.x and later causes breakage
Message ID:
20100125180301.51f7213e@pc09.procura.nl
On Mon, 25 Jan 2010 17:56:22 +0100, "H.Merijn Brand"
<h.m.brand@xs4all.nl> wrote:

> On Mon, 25 Jan 2010 09:32:55 -0700, karl williamson
> <public@khwilliamson.com> wrote:
> 
> > I have been thinking about this, and see an issue with the proposed 
> > solution: "they should be resolved and then converted to \x{...} not 
> > preserved verbatim".
> > 
> > The problem is that qr/\N{LATIN CHARACTER CAPITAL A}/ currently implies 
> > that the regex is to have Unicode semantics, and its resolved 
> > equivalent, \x41, does not.  Hence, the conversion loses information, 
> > and causes breakage.
> 
> isn't \x{0041} (note the 4 positions) not guaranteed to be Unicode,
> where \x41 and \x{41} are not?

Apparently not

pc09:/home/merijn 111 > perl -MDP -we'DDump"\x{20ac}"'
SV = PV(0x743298) at 0x745328
  REFCNT = 1
  FLAGS = (POK,READONLY,pPOK,UTF8)
  PV = 0x76e630 "\342\202\254"\0 [UTF8 "\x{20ac}"]
  CUR = 3
  LEN = 8
pc09:/home/merijn 112 > perl -MDP -we'DDump"\x{0081}"'
SV = PV(0x743298) at 0x745328
  REFCNT = 1
  FLAGS = (POK,READONLY,pPOK)
  PV = 0x76e630 "\201"\0
  CUR = 1
  LEN = 8
pc09:/home/merijn 113 > perl -MDP -we'DDump"\x{0041}"'
SV = PV(0x743298) at 0x745328
  REFCNT = 1
  FLAGS = (POK,READONLY,pPOK)
  PV = 0x76e630 "A"\0
  CUR = 1
  LEN = 8
pc09:/home/merijn 114 > perl -MDP -we'DDump"\N{U+41}"'
SV = PV(0x743298) at 0x745328
  REFCNT = 1
  FLAGS = (POK,READONLY,pPOK)
  PV = 0x76e630 "A"\0
  CUR = 1
  LEN = 8
pc09:/home/merijn 115 >

-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

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