Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

pudge (1)

  (email not shown publicly)
AOL IM: Crimethnk (Add Buddy, Send Message)

I run this joint, see?

Journal of pudge (1)

Friday April 19, 2002
06:17 AM

UTF8 Goodness!

[ #4322 ]

#!/usr/bin/perl -lw
use Digest::MD5 2.16 qw(md5_hex);
$a = "foo\x{100}";
print "   : ", md5_hex("");
print "$a: ",  md5_hex($a);
print "foo: ", md5_hex("foo");

Results in:

   : d41d8cd98f00b204e9800998ecf8427e
Use of uninitialized value in subroutine entry at Untitled #6 line 9.
foo: d41d8cd98f00b204e9800998ecf8427e
foo: acbd18db4cc2f85cedef654fccc4a4d8

Digest::MD5 changed to use SvPVbyte to get the value of the passed SV, instead of SvPV, and it totally broke in perl 5.6. For some reason, the fact that $a has UTF8 flag on makes it blow up. Fun fun fun! Gisle's looking into it; at the very least, maybe it can be changed to use SvPV for < 5.7, but still.

The original test case was using the result of XML::RSS / XML::Parser. Should XML::Parser be flagging SVs UTF8 in the first place, especially if there's no high-bit characters in them?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.