diff options
author | Joey Hess <joey@kitenet.net> | 2010-03-09 19:55:19 -0500 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-03-09 19:55:19 -0500 |
commit | 6d27bbd026ebed85f8501b6b4daefaba73061574 (patch) | |
tree | 6a0bee7e5fb6de5d5fd9b8dd4e1b3aeb2467673c /IkiWiki/Plugin/teximg.pm | |
parent | fa6d082955dbc75de62839e285c0d441cd83acb1 (diff) | |
download | ikiwiki-6d27bbd026ebed85f8501b6b4daefaba73061574.tar ikiwiki-6d27bbd026ebed85f8501b6b4daefaba73061574.tar.gz |
Fix utf8 issues in calls to md5_hex.
This prevented comments containing some utf-8, including euro sign, from
being submitted. Since md5_hex is a C implementation, the string has to be
converted from perl's internal encoding to utf-8 when it is called. Some
utf-8 happened to work before, apparently by accident.
Note that this will change the checksums returned.
unique_comment_location is only used when posting comments, so the checksum
does not need to be stable there.
I only changed page_to_id for completeness; it is passed a comment page
name, and they can currently never contain utf-8.
In teximg, the bug could perhaps be triggered if the tex source contained
utf-8. If that happens, the checksum will change, and some extra work might
be performed on upgrade to rebuild the image.
Diffstat (limited to 'IkiWiki/Plugin/teximg.pm')
-rw-r--r-- | IkiWiki/Plugin/teximg.pm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/teximg.pm b/IkiWiki/Plugin/teximg.pm index 0aaa79698..521af499f 100644 --- a/IkiWiki/Plugin/teximg.pm +++ b/IkiWiki/Plugin/teximg.pm @@ -8,6 +8,7 @@ use strict; use Digest::MD5 qw(md5_hex); use File::Temp qw(tempdir); use HTML::Entities; +use Encode; use IkiWiki 3.00; my $default_prefix = <<EOPREFIX; @@ -103,7 +104,7 @@ sub create ($$$) { $height = 12; } - my $digest = md5_hex($code, $height); + my $digest = md5_hex(Encode::encode_utf8($code), $height); my $imglink= $params->{page} . "/$digest.png"; my $imglog = $params->{page} . "/$digest.log"; |