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

utf8 patch for Storable

Thread Next
From:
Marc Lehmann
Date:
September 15, 2000 09:56
Subject:
utf8 patch for Storable
Message ID:
20000915185610.A4436@cerebro.laendle
Storable (in bleedperl) looses utf8-ness, below is a patch to fix
that (that works for me and wasn't too heavily tested). It is against
bleedperl, if I haven't mentioned that, and it will break compatibility to
non utf8-perls.

Design rationale:

- utf8 data is common (to will be), so I allocated two extra types for
  them, rather than extending the existing SX_SCALAR/LSCALAR.

- an alternative solution would be to sv_utf8_upgrade before storing and
  sv_utf8_downgrade (if possible) after thaw'ing. Since this costs time
  and changes the utf8 state in ways users might not expect it, I decided
  against this solution.

Another issue: I think Storable tainting all my data is a bug:

$tainted = thaw freeze $ref; # no external data
my $x = retrieve_fd FILE; # tainted
my $x = <FILE>;           # tainted

I think in the first case the result should only be tainted when the input
string is.

-- 
      -----==-                                             |
      ----==-- _                                           |
      ---==---(_)__  __ ____  __       Marc Lehmann      +--
      --==---/ / _ \/ // /\ \/ /       pcg@opengroup.org |e|
      -=====/_/_//_/\_,_/ /_/\_\       XX11-RIPE         --+
    The choice of a GNU generation                       |
                                                         |

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