aboutsummaryrefslogtreecommitdiff
path: root/doc/bugs/UTF-8_in_attachment_filenames.mdwn
blob: 07fff88d251c97df5684a58c7247924fa485d6ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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:

----

    diff -r -U 1 a/attachment.pm b/attachment.pm
    --- a/attachment.pm	2012-01-13 23:07:29.000000000 +0200
    +++ b/attachment.pm	2012-01-13 23:33:07.000000000 +0200
    @@ -274,2 +274,3 @@
     	foreach my $filename (glob("$dir/*")) {
    +	    $filename=Encode::decode_utf8($filename);
     		next unless -f $filename;
    @@ -347,2 +348,3 @@
     	foreach my $file (glob("$dir/*")) {
    +	    $file = Encode::decode_utf8($file);
     		next unless -f $file;

> Seems it only mangled display of the just-uploaded attachment's filename,
> the attachment was otherwise saved to disk with a valid UTF-8 name, and
> doing other stuff with it also was ok. In any case, I applied your patch,
> thanks. [[done]] --[[Joey]]