]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/removing_pages_with_utf8_characters.mdwn
Need more info.
[ikiwiki.git] / doc / bugs / removing_pages_with_utf8_characters.mdwn
1 I have a page with the name "umläute". When I try to remove it, ikiwiki says:
2
3 Error: ?umläute does not exist 
4
5 > I'm curious about the '?' in the "?umläute" message. Suggests that the
6 > filename starts with another strange character. Can I get a copy of a
7 > git repository or tarball containing this file? --[[Joey]] 
8
9 I wrote the following patch, which seems to work on my machine. I'm running on FreeBSD 6.3-RELEASE with ikiwiki-3.20100102.3 and perl-5.8.9_3.
10
11     --- remove.pm.orig      2009-12-14 23:26:20.000000000 +0100
12     +++ remove.pm   2010-01-18 17:49:39.000000000 +0100
13     @@ -193,6 +193,7 @@
14                             # and that the user is allowed to edit(/remove) it.
15                             my @files;
16                             foreach my $page (@pages) {
17     +                               $page = Encode::decode_utf8($page);
18                                     check_canremove($page, $q, $session);
19      
20                                     # This untaint is safe because of the
21
22
23 > The problem with this patch is that, in a recent fix to the same
24 > plugin, I made `@pages` come from `$form->field("page")`, and
25 > that, in turn is already run through `decode_form_utf8` just above the
26 > code you patched. So I need to understand why that is apparently not
27 > working for you. (It works fine for me, even when deleting a file named 
28 > "umläute" --[[Joey]] 
29
30 ----
31
32 > Update, having looked at the file in the src of the wiki that
33 > is causing trouble for remove, it is: `uml\303\203\302\244ute.mdwn`  
34 > And that is not utf-8 encoded, which, represented the same
35 > would be: `uml\303\244ute.mdwn`
36
37 > I think it's doubly-utf-8 encoded, which perhaps explains why the above
38 > patch works around the problem (since the page name gets doubly-decoded
39 > with it). The patch doesn't fix related problems when using remove, etc.
40
41 > Apparently, on apoca's system, perl encodes filenames differently
42 > depending on locale settings. On mine, it does not. Ie, this perl
43 > program always creates a file named `uml\303\244ute`, no matter
44 > whether I run it with LANG="" or LANG="en_US.UTF-8":
45
46 >       perl -e 'use IkiWiki; writefile("umläute", "./", "baz")'
47
48 > Remains to be seen if this is due to the older version of perl used
49 > there, or perhaps FreeBSD itself. --[[Joey]] 
50
51 > Update: Perl 5.10 fixed the problem. --[[Joey]]