Linux 删除转义字符
我们正在将 UniVerse 应用程序从 AIX 迁移到 Linux。移动后,一切都很好,除了包含转义字符 (char(27)) 的打印文件丢失转义字符并打印控制字符串的平面文本。我们已确认打印文件构建正确。它仅在将打印文件流式传输到打印机时执行此操作。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我理解正确的话,文件中的字符现在是
^
和[
而不是^[
文字转义,并且您想要文字逃脱。如果是这种情况,您可以使用:其中替换中的
^[
是文字转义,使用 Ctrl+V Esc 键入。如果这不是他们要打印的内容,请发布一个示例,说明它是什么以及应该是什么。
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: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.
我们刚刚从 HP 迁移到 Linux,在 CentOS 5.9 上遇到同样的问题(但在 RHEL 6.4 上没有!)。对于我们来说,解决方案是在 sp.config 引用的驱动程序文件中使用的 lpr 命令上使用“-o raw”选项。解决方案的另一半是,我们必须更改打印机设置,以便在没有自己的 CR 的情况下完成 LF 时自动执行 CR,否则会在页面上“阶梯式”打印行。青年MMV
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