From: Charlie Bursell on 2 Apr 2010 12:05 I must be doing something dumb but can't figure out what it is. I wanted to validate that the tcllib version of uuencode/uudecode would work so I used the GNU command line uuencode to encode a simple PDF document, I then read that uuencoded file into tcl using fcongiure -translation binary and run it throug uuencoeLLdecode and even uuencode::uudecode and write the output to a file. I would expect the decoded file to be the same PDF file I originaly encoded but it is not even close, For example, the first few line of the proper PDF file look like: %PDF-1.2 %ÎÏâ§â 2 0 obj << /D [1 0 R /XYZ null 895 null] >> What I get from the tcllib decode is something like: QÃ8â£?@â?d?gT?â£9âºâ ª?Uâ¦Db?â? ¢^.<?0?£"â¥â»â ö& £??¢ôBâ£?ââ¥â»â£"â»???¢â çV??l 895 null] >> endobj 3 0 obj << /D [1 0 R /Xª??¢â çVÃ?â¥â¼?râ çVÃà ?£?à ?VæFö& £Bâ¥â»â ö& £??¢ôBâ£?â Can anyone put me on the right track?
From: Andreas Leitgeb on 2 Apr 2010 12:59 Charlie Bursell <cbursell(a)geusnet.com> wrote: > I must be doing something dumb but can't figure out what it is. > I wanted to validate that the tcllib version of uuencode/uudecode > would work so I used the GNU command line uuencode to encode a simple > PDF document, > > I then read that uuencoded file into tcl using fcongiure -translation > binary and run it throug uuencoeLLdecode and even uuencode::uudecode > and write the output to a file. I guess the mistake happened when writing back to file. I tried this (with some xyz.pdf): on unix shell: uuencode xyz.pdf xyz.pdf > xyz.uu in tclsh: package require uuencode set x [uuencode::uudecode -file xyz.uu]; llength $x;# -> 1 this $x is a list of entries of the uu-file set y [lindex $x 0]; llength $y this $y is a three element list describing that entry set z [lindex $y 2]; string length $z this $z now is the binary content of the original pdf now write it back to file: open out.pdf w ;# gave me file5 fconfigure file5 -translation binary puts -nonewline file5 $z; close file5 and back in unix shell: diff out.pdf xyz.pdf ;# -> equal > I would expect the decoded file to be the same PDF file I originaly > encoded but it is not even close, Normally, a safe bet. If you did essentially the same, but still get rubbish, then post the first six lines of the uuencoded text, (but NOT the complete uu!!), so we can see, if something went completely wrong in encoding.
From: Charlie Bursell on 2 Apr 2010 16:43 On Apr 2, 11:59 am, Andreas Leitgeb <a...(a)gamma.logic.tuwien.ac.at> wrote: > Charlie Bursell <cburs...(a)geusnet.com> wrote: > > I must be doing something dumb but can't figure out what it is. > > I wanted to validate that the tcllib version of uuencode/uudecode > > would work so I used the GNU command line uuencode to encode a simple > > PDF document, > > > I then read that uuencoded file into tcl using fcongiure -translation > > binary and run it throug uuencoeLLdecode and even uuencode::uudecode > > and write the output to a file. > > I guess the mistake happened when writing back to file. > > I tried this (with some xyz.pdf): > on unix shell: > uuencode xyz.pdf xyz.pdf > xyz.uu > in tclsh: > package require uuencode > set x [uuencode::uudecode -file xyz.uu]; llength $x;# -> 1 > this $x is a list of entries of the uu-file > set y [lindex $x 0]; llength $y > this $y is a three element list describing that entry > set z [lindex $y 2]; string length $z > this $z now is the binary content of the original pdf > now write it back to file: > open out.pdf w ;# gave me file5 > fconfigure file5 -translation binary > puts -nonewline file5 $z; close file5 > and back in unix shell: > diff out.pdf xyz.pdf ;# -> equal > > > I would expect the decoded file to be the same PDF file I originaly > > encoded but it is not even close, > > Normally, a safe bet. > > If you did essentially the same, but still get rubbish, then post the > first six lines of the uuencoded text, (but NOT the complete uu!!), > so we can see, if something went completely wrong in encoding. I think I may have figured it out some what The command "uuencode::uudecode $file" returns a list of lists where the first list is a single element list and the next contains 3 elements So doing something like this seems to work: set lst [lindex [uuencode::uudecode $file] 0] set Filename [lindex $lst 0] set perms [lindex $lst 1] set data [lindex $lst 2] I never could get anything going with uuencode::decode. Perhaps this is just for single simple strings? Thanks for the response
|
Pages: 1 Prev: AUTHENTIC DESIGNER HANDBAGS WWW.VOGUELANDE.COM. CHANEL, LOUIS VUITTON, GUCCI Next: ftp(s) |