29 | | I have not (yet) tested with python3. |
| 29 | In python 3 it fails too, but probably only because of the forced post-query-string-parser decoding into unicode string: to support binary values we don't want decoding at this point. |
| 30 | |
| 31 | A test for python3: |
| 32 | {{{#!python |
| 33 | def test_binary_input(self): |
| 34 | """ |
| 35 | QueryDicts must be able to handle binary. |
| 36 | """ |
| 37 | q = QueryDict(b'foo=%00%7f%80%ff') |
| 38 | self.assertListEqual(list(map(ord, q['foo'])), [0x00, 0x7F, 0x80, 0xFF]) |
| 39 | }}} |
| 40 | {{{ |
| 41 | AssertionError: Lists differ: [0, 127, 65533, 65533] != [0, 127, 128, 255] |
| 42 | |
| 43 | First differing element 2: |
| 44 | 65533 |
| 45 | 128 |
| 46 | |
| 47 | - [0, 127, 65533, 65533] |
| 48 | + [0, 127, 128, 255] |
| 49 | }}} |