2012-01-20 18:50:05 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
def decode (s):
|
|
|
|
return '<' + ','.join ("U+%04X" % ord (u) for u in unicode (s, 'utf8')) + '>'
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
|
|
if len (sys.argv) == 1 or ('--stdin' in sys.argv and len (sys.argv) != 2):
|
2012-01-20 19:21:53 +00:00
|
|
|
print "Usage:\n %s UNICODE_STRING...\nor:\n %s --stdin" % (sys.argv[0], sys.argv[0])
|
2012-01-20 18:50:05 +00:00
|
|
|
sys.exit (1)
|
|
|
|
|
|
|
|
if '--stdin' in sys.argv:
|
|
|
|
sys.argv.remove ('--stdin')
|
|
|
|
for line in sys.stdin.readlines ():
|
|
|
|
print decode (line)
|
|
|
|
else:
|
|
|
|
print ' '.join (decode (x) for x in (sys.argv[1:]))
|