]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/UTF-8_in_attachment_filenames.mdwn
Merge remote-tracking branch 'anarcat/dev/syslog_utf8'
[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
2 locale). The attachment plugin mangles UTF8-encoded attachment filenames if
3 the name contains multibyte characters, e.g. "lää.png" becomes "lää.png".
4 Apparently glob returns byte strings which are subject to implicit
5 upgrading when concatenated with Perl strings. The following patch fixes
6 the problem for me:
7
8 ----
9
10     diff -r -U 1 a/attachment.pm b/attachment.pm
11     --- a/attachment.pm 2012-01-13 23:07:29.000000000 +0200
12     +++ b/attachment.pm 2012-01-13 23:33:07.000000000 +0200
13     @@ -274,2 +274,3 @@
14         foreach my $filename (glob("$dir/*")) {
15     +       $filename=Encode::decode_utf8($filename);
16                 next unless -f $filename;
17     @@ -347,2 +348,3 @@
18         foreach my $file (glob("$dir/*")) {
19     +       $file = Encode::decode_utf8($file);
20                 next unless -f $file;
21
22 > Seems it only mangled display of the just-uploaded attachment's filename,
23 > the attachment was otherwise saved to disk with a valid UTF-8 name, and
24 > doing other stuff with it also was ok. In any case, I applied your patch,
25 > thanks. [[done]] --[[Joey]]