##
$arg =~ s/([[:cntrl:]]|[[:^ascii:]])/sprintf("\\x{%x}",ord($1))/eg;
####
# The following handling of "control chars" is direct from
# the original code - I think it is broken on Unicode though.
# Suggestions?
####
heavy machinery, no user serviceable parts inside