Linux dropping escape characters

389 views Asked by At

We are migrating our UniVerse application from AIX to Linux. After moving, all is good except print files that contain escape characters (char(27)) are losing the escape character and printing flat text of the control string. We have confirmed that the print file is constructed properly. It only does this when streaming the print file to the printers.

2

There are 2 answers

0
Kevin On

If I understand you correctly, the characters in the file are now ^ and [ instead of the ^[ literal escape, and you want the literal escape. If that's the case, you can use:

sed -i 's/\^\[/^[/g' oldfile >newfile

where ^[ in the replacement is a literal escape, typed with Ctrl+V Esc.

If that's not what they're printing, please post an example of what it is and what it should be.

0
rbl On

We just migrated from HP to linux and have the same problem on CentOS 5.9 (but not on RHEL 6.4!). For us, the solution was to use the '-o raw' option on the lpr command that is used in the driver file we have being reference by the sp.config. The other half of the solution is that we had to change the printer settings to automatically do a CR when a LF is done without its own CR, otherwise print lines 'stair-step' across the page. YMMV