[PHPLIB] printer escape sequences (fwd) From: Arno A. Karner (karner <email protected>)
Date: 03/14/00

well new chapter to the saga, it appears that its the php parser that
parses the \ooo slash escape sequence and not printf, or sprintf. so now i
got the escape sequences in a data base, and am trying to use them open
pipe to printer command and output the escape sequences and get them
converted from there \ooo 3digit ocata representation to the ascii char
they represent. some of theses sequences still need to pass thru an
sprintf statment b 4 going, ie one escape sequence to select paper source

$s="\\033&l%sH"
would like to do
fput($fp,sprintf($s,"1"));
and have it output "<esc>&l1H" instead it outputs "\033"

solution yeeehaaaaaaaa, ne comments about a better way welcome

function wriesc($fp,$e,$p="") {
        if($p=="") {
                $c ="\$s = sprintf(\"$e\");";
                eval($c);
        } else {
                $c = "\$s = sprintf(\"$e\",\"$p\");";
                eval($c); }
// show_strchr($s);
// echo"<br>hello '$c'<br>";
        fputs($fp,$s);
} //func

ne 1 have ideas on how to best represent printer escape sequences and then
be able to convert to a binary string plus beable to do parameter
substitution using a sprintf statment some where from the database to the
printer, and be able to edit in a form my first thought is \xx for a hex
digits, ive looked thru php mail search (printer,binary) no help there

so got some stuff figured out, finding nice features that are not
documented, or bugs if ur not looking for them.
inputing \033 in the form, and adding slashes b 4 it goes into the data
base (postgres) i end up with \033 in the database, postgres interpts
slash escape sequences. :-/ ie \033 becomes a singe escape character.
printf, sprintf also interpit \033 as escape in the format string :-)
and dont have the old unix problem of limited range of \000 .. \077
\377 = 255 since this is not documented will it always stay?

is this normal sql data base behavor?, dont care about winblows odbc crap?

next to write test code to figure out fputs, fwrite fputs says its
identical to fwrite, but the functional discriptions lie, or the
documentation lies. hopefuly next time some searchs archives for printer
binary escape codes theyl find some thing useful

My opinions are my own and not that of my employer even if I am self employed
One man's bug is another man's feature :-)

-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.