]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/UTF-8_in_attachment_filenames.mdwn
6e79a4e064b8ef24ffd31511b434f78f217c42f5
[ikiwiki.git] / doc / bugs / UTF-8_in_attachment_filenames.mdwn
1 I have ikiwiki_3.20111229 installed on Debian Squeeze (Perl 5.10.1, UTF-8 locale). The attachment plugin mangles UTF8-encoded attachment filenames if the name contains multibyte characters, e.g. "lää.png" becomes "lää.png". Apparently glob returns byte strings which are subject to implicit upgrading when concatenated with Perl strings. The following patch fixes the problem for me:
2
3 ----
4
5     diff -r -U 1 a/attachment.pm b/attachment.pm
6     --- a/attachment.pm 2012-01-13 23:07:29.000000000 +0200
7     +++ b/attachment.pm 2012-01-13 23:33:07.000000000 +0200
8     @@ -274,2 +274,3 @@
9         foreach my $filename (glob("$dir/*")) {
10     +       $filename=Encode::decode_utf8($filename);
11                 next unless -f $filename;
12     @@ -347,2 +348,3 @@
13         foreach my $file (glob("$dir/*")) {
14     +       $file = Encode::decode_utf8($file);
15                 next unless -f $file;