Article View: adobe.postscript.programming
Article #267ASCII-85 Encoding per PS 3rd ED Spec
From: Outtascope
Date: Wed, 04 Oct 2006 15:47
Date: Wed, 04 Oct 2006 15:47
10 lines
2175 bytes
2175 bytes
Is there an error in the Postscript Language Reference regarding ASCII-85 Encoding or am I just fundamentally messed up? According to the spec as I read it, if your input data ends with n bytes, where n is less than 4, you pad the data with 4 - n zeros to create the base 256 4-tupple. You then encode as normal (convert to base 85, add 33 to each byte to make it printable), but only output the first n + 1 bytes. This presumes that you could encode an 8 bit byte with only two base 85 digits. While this is true, it does not hold if you encode it "normally". For instance, consider an input file consisting of a single digit: "." The ascii value for . (period) is 46. Our resulting 4-tupple of 46,0,0,0 gives us an integral value of 771751936. Coding this in base-85 gives us the sequence of 14,66,56,74,46 or /cYGO after applying the addition of '!' (ascii 33) to each digit to get it in the printable range. According to the spec this would be output simply as /c followed by ~> (n+1 digits plus EOD marker). Subsequent decoding of this, however, gives us a value of 45. You could encode 46 using two digits as /d, but no where in the spec can I see reference to doing this. You could also handle this in the decoder, recognizing /c as 46 rather than the calculated 45. Since it isn't clearly specified, you have a 50/50 chance or either fixing the error, or compounding it. Is my understanding correct or can anyone tell me the error that I am making? Thanks.
Technical Details
Message-ID:
<3bc1deaa.-1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!news.buerger.net!open-news-network.org!news.isoc.lu!webcrossingShow Full Headers
Complete Article Headers
X-Google-Thread: 10c61a,1eae8f07fad75f86,start X-Google-Attributes: gid10c61a,public X-Google-Language: ENGLISH,ASCII-7-bit From: Outtascope@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!news.buerger.net!open-news-network.org!news.isoc.lu!webcrossing Newsgroups: adobe.postscript.programming Subject: ASCII-85 Encoding per PS 3rd ED Spec Message-ID: <3bc1deaa.-1@webcrossing.la2eafNXanI> Date: Wed, 4 Oct 2006 08:47:15 -0700 Lines: 28 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit