python's YENC.DECODE -> weird output

John Savage rookswood at suburbian.com.au
Wed Jul 16 15:33:46 CEST 2008


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

    fd1=open(sys.argv[1],'r') 
    #yenc.encode(sys.argv[1],"outfile.yenc",bytes=0)
    yenc.decode(sys.argv[1],"outfile.mid",bytes=0,crc_in='')

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?
-- 
John Savage                (my news address is not valid for email)



More information about the Python-list mailing list