Skip Menu |

This queue is for tickets about the XML-Diff CPAN distribution.

Report information
The Basics
Id: 15822
Status: open
Priority: 0/
Queue: XML-Diff

People
Owner: Nobody in particular
Requestors: roeyalmog [...] 013.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.04
Fixed in: (no value)



Subject: fail to comprare utf-8 files
problem in XML-Diff-0.04 on perl v5.8.4 built for MSWin32-x86-multi-thread Due to limitation in Digest::MD5 that works only on ascii strings, so the following line fails if $thumbprint contains utf-8 wide characters: 568: $md5_2->add($thumbprint); To fix it follow the remark about utf-8 in Digest::MD5: Show quoted text
>What you can do is calculate the MD5 checksum of the UTF-8 >representation of such strings. This is achieved by filtering the string >through encode_utf8() function: > > use Digest::MD5 qw(md5_hex); > use Encode qw(encode_utf8); > > my $str = "abc\x{300}"; > print md5_hex(encode_utf8($str)), "\n"; > # 8c2d46911f3f5a326455f0ed7a8ed3b3
So I simply changed the code: $md5_2->add(encode_utf8($thumbprint)); and added use Encode qw(encode_utf8);
Here's a patch. Does this module need a new maintainer?
49a50 > use Encode qw(encode_utf8); 568c569 < $md5_2->add($thumbprint); --- > $md5_2->add(encode_utf8($thumbprint));