python's YENC.DECODE -> weird output
sjmachin at lexicon.net
Thu Jul 17 00:33:55 CEST 2008
On Jul 16, 11:33 pm, John Savage <rooksw... at suburbian.com.au> wrote:
> I save posts from a midi music newsgroup, some are encoded with
> yenc encoding. This gave me an opportunity to try out the decoders
> in Python. The UU decoder works okay, but my YENC effort gives
> results unexpected:
> import yenc, sys
> I confirmed that yenc.decode exactly reverses yenc.encode, BUT the
> encoding itself seems to differ from the USENET standard. That is,
> when I decode USENET files the result isn't a valid music file.
> (I did try both with and w/o the headers.)
> Maybe it uses a different character set? I can't quite put my
> finger on what might be happening. What I can say is that the
> yenc coding from the newsgroup article, when viewed with Linux
> 'more', displays roughly 10% of its characters as a question mark,
> whereas when I give Python's yenc.encode a binary music file and
> view its output using 'more', it displays about 90% of the output
> as a question mark.
> Any ideas?
1. It isn't "Python's yenc". Consider directing your question to
whoever (if anyone) is maintaining whichever third-party module you
are talking about.
2. Consider using a tool that will display what is going on in
characters and hex e.g. http://linux.about.com/library/cmd/blcmdl1_hexdump.htm
More information about the Python-list