]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/garbled_non-ascii_characters_in_body_in_web_interface.mdwn
headers
[ikiwiki.git] / doc / bugs / garbled_non-ascii_characters_in_body_in_web_interface.mdwn
1 since my latest jessie upgrade here, charsets are all broken when editing a page. the page i'm trying to edit is [this wishlist](http://anarc.at/wishlist/), and it used to work fine. now, instead of:
2
3 `Voici des choses que vous pouvez m'acheter si vous êtes le Père Nowel (yeah right):`
4
5 ... as we see in the rendered body right now, when i edit the page i see:
6
7 `Voici des choses que vous pouvez m'acheter si vous �tes le P�re Nowel (yeah right):`
8
9 ... a typical double-encoding nightmare. The actual binary data is this for the word "Père" according to `hd`:
10
11 ~~~~
12 anarcat@marcos:ikiwiki$ echo "Père" | hd
13 00000000  50 c3 a8 72 65 0a                                 |P..re.|
14 00000006
15 anarcat@marcos:ikiwiki$ echo "P�re" | hd
16 00000000  50 ef bf bd 72 65 0a                              |P...re.|
17 00000007
18 ~~~~
19
20 > I don't know what that is, but it isn't the usual double-UTF-8 encoding:
21 >
22 >     >>> u'è'.encode('utf-8')
23 >     '\xc3\xa8'
24 >     >>> u'è'.encode('utf-8').decode('latin-1').encode('utf-8')
25 >     '\xc3\x83\xc2\xa8'
26 >
27 > A packet capture of the incorrect HTTP request/response headers and body
28 > might be enlightening? --[[smcv]]
29 >
30 > > Here are the headers according to chromium:
31 > > 
32 > > ~~~~
33 > > GET /ikiwiki.cgi?do=edit&page=wishlist HTTP/1.1
34 > > Host: anarc.at
35 > > Connection: keep-alive
36 > > Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
37 > > User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
38 > > Referer: http://anarc.at/wishlist/
39 > > Accept-Encoding: gzip,deflate,sdch
40 > > Accept-Language: fr,en-US;q=0.8,en;q=0.6
41 > > Cookie: openid_provider=openid; ikiwiki_session_anarcat=XXXXXXXXXXXXXXXXXXXXXXX
42 > > 
43 > > HTTP/1.1 200 OK
44 > > Date: Mon, 08 Sep 2014 21:22:24 GMT
45 > > Server: Apache/2.4.10 (Debian)
46 > > Set-Cookie: ikiwiki_session_anarcat=XXXXXXXXXXXXXXXXXXXXXXX; path=/; HttpOnly
47 > > Vary: Accept-Encoding
48 > > Content-Encoding: gzip
49 > > Content-Length: 4093
50 > > Keep-Alive: timeout=5, max=100
51 > > Connection: Keep-Alive
52 > > Content-Type: text/html; charset=utf-8
53 > > ~~~~
54 > > 
55 > > ... which seem fairly normal... getting more data than this is a little inconvenient since the data is gzip-encoded and i'm kind of lazy extracting that from the stream. Chromium does seem to auto-detect it as utf8 according to the menus however... not sure what's going on here. I would focus on the following error however, since it's clearly emanating from the CGI... --[[anarcat]]
56
57 Clicking on the Cancel button yields the following warning:
58
59 ~~~~
60 Error: Cannot decode string with wide characters at /usr/lib/x86_64-linux-gnu/perl/5.20/Encode.pm line 215.
61 ~~~~
62
63 The apache logs yield:
64
65 ~~~~
66 [Mon Sep 08 16:17:43.995827 2014] [cgi:error] [pid 2609] [client 192.168.0.3:47445] AH01215: Died at /usr/share/perl5/IkiWiki/CGI.pm line 467., referer: http://anarc.at/ikiwiki.cgi?do=edit&page=wishlist
67 ~~~~
68
69 Interestingly enough, I can't reproduce the bug here (at least in this page). Also, editing the page through git works fine.
70
71 I had put ikiwiki on hold during the last upgrade, so it was upgraded separately. The bug happens both with 3.20140613 and 3.20140831. The major thing that happened today is the upgrade from perl 5.18 to 5.20. Here's the output of `egrep '[0-9] (remove|purge|install|upgrade)' /var/log/dpkg.log | pastebinit -b paste.debian.net` to give an idea of what was upgraded today:
72
73 http://paste.debian.net/plain/119944
74
75 This is a major bug which should probably be fixed before jessie, yet i can't seem to find a severity statement in reportbug that would justify blocking the release based on this - unless we consider non-english speakers as "most" users (i don't know the demographics well enough). It certainly makes ikiwiki completely unusable for my users that operate on the web interface in french... --[[anarcat]]