The character sequences you're seeing in the above that look like
[0m[7 are escape sequences for display on a terminal screen using
ncurses, the
CRT screen handling and optimization package. Those sequences are specific to a particular terminal type (probably, on your Linux system, an X terminal). Note that a "terminal type" can also be a printer. The sequences are what give you lines, boxes, highlights and the like.
Take a look at the manual pages for
ncurses and
termcap for a complete explanation. Also execute the
env utility:
Code:
env | grep TERM
TERM=xterm
TERMCAP=vs|xterm|xterm-color|vs100|xterm terminal emulator (X Window System):am:bs:km:co#100:li#56:ct=\E[3k:ue=\E[m:is=\E[m\E[?1l\E>:rs=\E[m\E[?1l\E>:eA=\E)0:as=^N:ae=^O:ac=aaffggjjkkllmmnnooqqssttuuvvwwxx:kI=\E[2~:kD=^?:kP=\E[5~:kN=\E[6~:k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k0=\E[21~:F1=\E[23~:F2=\E[24~:kh=\E[H:kH=\EOw:ks=:ke=:te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:ms:pt:xn:xo:it#8:RA=\E[?7l:SA=\E?7h:bl=^G:cr=^M:ta=^I:cm=\E[%i%d;%dH:le=^H:up=\E[A:do=\E[B:nd=\E[C:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:DO=\E[%dB:ho=\E[H:cl=\E[H\E[2J:ce=\E[K:cb=\E[1K:cd=\E[J:sf=\ED:sr=\EM:st=\EH:cs=\E[%i%d;%dr:sc=\E7:rc=\E8:ic=\E[@:IC=\E[%d@:al=\E[L:AL=\E[%dL:dc=\E[P:DC=\E[%dP:dl=\E[M:DL=\E[%dM:so=\E[7m:se=\E[m:us=\E[4m:mb=\E[5m:mh=\E[2m:md=\E[1m:mr=\E[7m:me=\E[m:kb=^?:ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:
The above is my system, indicating an X-terminal and showing the escape sequences for performing certain actions (yours may vary!). All those two-character alphabetic sequences, such as
ue=\E[m, are the functions that the terminal can perform --
us is the curses code for "start underlining" and "escape-bracket-m" is the code that will do so for and X-terminal.
Something to bear in mind here is that the two-character codes are the same across devices, the escape sequences are what's different between devices (look at the
termcap data base and note how many different devices are supported).
If you're looking at the report in Gmail, chances are you're not going to see anything that makes sense (as above?); I'm not sure if Gmail strips out escape characters (all those sequences are preceded by an escape character, which, in the
termcap data base is indicated as
\E. Usually you're looking at Gmail in a web page, not at all the same thing as an X-terminal.
So, what to do? If you can set Gmail to display as a terminal emulator (such as
xterm) you ought to see what you expect; however, it's unlikely that you'll be able to do that on a Windows box, eh? Maybe, maybe not, who knows. I have no idea whatsoever of how you can discover what terminal type might be useful with Gmail (perhaps VT-100? I don't know). If you could discover that, then, before you execute your report program simply
Code:
export TERM=whatever
execute the report
And you'd probably get what you want at the other end with no further fiddling around.
As an option, you might try
Code:
export TERM=dumb
execute the report
That, for historic reasons, may strip out all the sequences for you. Put the
export in you shell program that launches the report
after the line that executes
.profile. Might work.
Hope this helps some.