mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
276 B
13 lines
276 B
#!/usr/bin/env python2
|
|
#
|
|
# Paranoia escape input file to be printable ASCII.
|
|
#
|
|
|
|
import os, sys
|
|
|
|
inp = sys.stdin.read().decode('utf-8')
|
|
for c in inp:
|
|
if (ord(c) >= 0x20 and ord(c) <= 0x7e) or (c in '\x0a'):
|
|
sys.stdout.write(c)
|
|
else:
|
|
sys.stdout.write('\\u%04x' % ord(c))
|
|
|