> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of > Tom Phoenix > Sent: Thursday, February 23, 2006 2:43 PM > To: Ryan Frantz > Cc: beginners@perl.org > Subject: Re: Non-printing Characters > > On 2/23/06, Ryan Frantz <[EMAIL PROTECTED]> wrote: > > > I've got a few reports that are generated by a third-party app that we > use > > and the raw report files include incomprehensible strings at the > beginning > > of each page like so: > > > > &k2S&l6D > > I wonder whether those are supposed to be escape sequences, as one > might send to a video terminal. Those typically are signalled by a > non-printing character (such as "\x1b", esc) followed by... well, > anything goes, really. But you can figure out the rules for your data.
Typically, the reports are generated and sent directly to the printer. I do have the ability to save the report in a spool so that I can print it at my leisure and even print it to a text file (which I've done). However, those stray strings are present. I believe that they are commands (or remnants of commands) sent to the printer. I (sort of) know this because I used to work for the vendor that wrote the (cr)application (as a tech, not a developer). > > Or, maybe you can tell your third-party app that you're not using a > fancy video terminal. Check its docs to see whether it respects the > TERM environment variable. > > > What kind of text/coding/whatever is this and what tools are available > that > > I can use to search for this content (to remove it)? > > Tools? You've got Perl! :-) Obviously. ;) Since I'm not really sure what I'm looking at, I don't know what questions to ask. > > The trick is to know how to tell Perl how to tell the wheat from the > chaff. If you can dump the file contents, you might be able to figure > out the encoding. In these cases I use the Unix command 'od -xc > somefile | less' to see what I can see of a file's format. This is helpful. I've never used 'od' but I'm aware of it. I can start using/learning it. > > Another way to see what's inside would be to step through a simple > program in Perl's debugger, using the 'x' command periodically to > examine a variable's contents. (In this case, $_.) > > perl -ndebug somefile > > Does this help you to make any progress? If you can see what's going > on in the file, but you can't turn that knowledge into Perl code, let > us know. Good luck with it! Yes. This gives me a place to start looking and learning more about this type of content so that I can ask better questions next go 'round. Obliged. > > --Tom Phoenix > Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>