Article View: comp.lang.postscript
Article #3034A filter to convert 8-bit codes to octal escape codes
From: Oreo Cat
Date: Fri, 07 Sep 1990 21:52
Date: Fri, 07 Sep 1990 21:52
49 lines
2052 bytes
2052 bytes
I recently had trouble printing out some postscript files which I had
received over the net. I tracked it down the problem and discovered
that the computer and printer where only talking to each other in
7-bits, but the files had some 8-bit codes. I had never noticed this
problem before because most software will send these codes as octal
escape sequences. So I wrote up the below attached filter to convert
any stray 8-bit characters to their respective octal escape sequences.
Nothing all that special, but it could save someone a lot of work
someday. Also I strongly recommend anyone distributing postscript
documents to use this filter to save headaches.
(If anyone has a /etc/printcap that lets a Apple Laserwriter + and
Sun Sparcstation 1 talk 8-bits, please let me know!!)
Jim Lick
Work: University of California | Home: 6657 El Colegio #24
Santa Barbara | Isla Vista, CA 93117-4280
Dept. of Mechanical Engr. | (805) 968-0189 voice
2311 Engr II Building | (805) 968-1239 data 1
(805) 893-4113 | (805) 968-2734 data 2
jim@ferkel.ucsb.edu | bahamut!jim@ivucsb.sba.ca.us
--- CUT HERE ---
/*
** Copyright (C) 1990 by Jim Lick
** jim@ferkel.ucsb.edu
** bahamut!jim@ivucsb.sba.ca.us
**
** ps8to7.c
**
** This program filters postscript code to convert any 8-bit characters
** to octal coding for printing or file transfer over 7-bit channels.
*/
#include <stdio.h>
main()
{
unsigned char c;
while(!feof(stdin))
{
c=getchar();
if(c<128)
putchar(c);
else
printf("\\%o",c);
}
}
Technical Details
Message-ID:
<6244@hub.ucsb.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!usc!ucsd!hub.ucsb.edu!piggy.ucsb.edu!jimShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!usc!ucsd!hub.ucsb.edu!piggy.ucsb.edu!jim From: jim@piggy.ucsb.edu (Oreo Cat) Newsgroups: comp.lang.postscript Subject: A filter to convert 8-bit codes to octal escape codes Message-ID: <6244@hub.ucsb.edu> Date: 7 Sep 90 21:52:25 GMT Sender: news@hub.ucsb.edu Organization: Laputa, Castle in the Sky Lines: 49