perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fernando Munoz <fmu...@lgecorp.com>
Subject RE: UTF8 issue
Date Wed, 29 Jan 2003 19:17:15 GMT
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@aaanime.net]
Sent: Wednesday, January 29, 2003 11:12 AM
To: Fernando Munoz
Cc: 'asp@perl.apache.org'
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@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Mime
View raw message