Skip to content

problems with encoding of binary data #2

@jpriebe

Description

@jpriebe

Thanks for contributing this module -- it looks very promising. I'm using it with python 2.6.5, and I have been running into issues like this:

20:57:58 T:2960314368 ERROR: File "/Applications/XBMC.app/Contents/Resources/XBMC/addons/webinterface.qxbmc/zipstream2.py", line 175, in FileHeader
20:57:58 T:2960314368 ERROR: return header + self.filename + extra
20:57:58 T:2960314368 ERROR: UnicodeDecodeError: 'ascii' codec can't decode byte 0xec in position 10: ordinal not in range(128)

(I've made some modifications to zipstream to be able to zip an arbitrary list of files rather than an entire directory tree, so you'll notice that my line numbers don't match yours; but I did also get this error with the unmodified code).

It seems that python is trying to interpret the header as if it were some sort of character data.

There are a few places in the code where this happens. I've been able to code around some of them by making multiple calls to yield instead of joining the binary strings together, but I'm not sure that's the right thing to do.

It also only happens with certain input files; some files don't trigger the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions