python's YENC.DECODE -> weird output

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Savage

    python's YENC.DECODE -> weird output

    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.ar gv[1],'r')
    #yenc.encode(sy s.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)
  • John Machin

    #2
    Re: python's YENC.DECODE -> weird output

    On Jul 16, 11:33 pm, John Savage <rooksw...@subu rbian.com.auwro te:
    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.ar gv[1],'r')
    #yenc.encode(sy s.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?
    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

    Comment

    • Terry Reedy

      #3
      Re: python's YENC.DECODE -&gt; weird output



      John Savage 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
      >
      fd1=open(sys.ar gv[1],'r')
      #yenc.encode(sy s.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.
      I do not believe that there really is a yenc standard. I have noticed
      that the yenc decoder in Mozilla Thunderbird never decodes posts from
      certain posters (and hence certain encoders) whereas uu decoding only
      sporadically fails.

      Comment

      Working...