Loading ...
Sorry, an error occurred while loading the content.

998RE: UTF8 issue

Expand Messages
  • Fernando Munoz
    Jan 29, 2003
      I've realized that. I'm using the "use utf8" approach, but I think the other
      approach could work in older versions not having utf8.pm;

      -----Original Message-----
      From: Philip Mak [mailto:pmak@...]
      Sent: Wednesday, January 29, 2003 11:12 AM
      To: Fernando Munoz
      Cc: 'asp@...'
      Subject: Re: UTF8 issue


      On Wed, Jan 29, 2003 at 10:57:12AM -0800, Fernando Munoz wrote:
      > Thanks Phillip, that solves the problem. I managed myself to find a less
      > elegant but, equally effective, solution. I operates over the string
      passing
      > the result to a second scalar that gets encoded as a string of bytes:
      >
      > my $lstring = length($description);
      > my $newdesc = substr($description,0,$lstring); <- Here $newdesc has
      $description as a string of bytes
      >
      > After this the digests are all different and correct. It is not
      > elegant but works.

      Using substr() to unset the string's UTF8 flag seems to be a dangerous
      thing to do; it may work now, but if a future version of Perl changes
      substr() to understand characters instead of bytes, then your above
      code would end up having no effect.
      ___________________________________________________
      Lions Gate Entertainment, Inc. [ AMEX: lgf ]
      Five Proud Years, One Independent Spirit.

      ---------------------------------------------------------------------
      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...
    • Show all 8 messages in this topic