On 05/21/2014 04:42 PM, Jeremy White wrote:
Hi,
Looks good but maybe it's better to use isprint
I'm not aware of an isprint Javascript function; do you have a pointer
to that, or to a similar function?
I too am not aware of isprint javascript function.
I found that Java has Java.lang.Character.isISOControl which suppose to
be isprint equivalent.
I wrote a simple C program that loops from 1 to 255 (inclusive) and
prints values
that are printable. Those values are 32 - 126.
The simplest implementation for isprint for is something like:
function isprint(c)
{
return ((c >= 32) && (c <= 126));
}
But maybe it's too simple and does not account for different encodings.
(Maybe defining the isnonprint function -- c<32 || c==127 -- is safer)
Anyway, it's just a suggestion.
Since you added a check for == 8 (backspace) it checks more than newlines,
and I thought you can protect against other non-printable characters
(such as DEL == 127).
Thanks,
Uri
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel