From f868e1b84d2f73688d4d6558d44610b1ac75ec13 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 20 Jan 2012 13:50:05 -0500 Subject: [PATCH] Add hb-unicode-decode --- .../{hb-read-manifest => hb-manifest-read} | 0 ...hb-update-manifests => hb-manifest-update} | 0 test/shaping/hb-unicode-decode | 19 +++++++++++++++++++ 3 files changed, 19 insertions(+) rename test/shaping/{hb-read-manifest => hb-manifest-read} (100%) rename test/shaping/{hb-update-manifests => hb-manifest-update} (100%) create mode 100755 test/shaping/hb-unicode-decode diff --git a/test/shaping/hb-read-manifest b/test/shaping/hb-manifest-read similarity index 100% rename from test/shaping/hb-read-manifest rename to test/shaping/hb-manifest-read diff --git a/test/shaping/hb-update-manifests b/test/shaping/hb-manifest-update similarity index 100% rename from test/shaping/hb-update-manifests rename to test/shaping/hb-manifest-update diff --git a/test/shaping/hb-unicode-decode b/test/shaping/hb-unicode-decode new file mode 100755 index 000000000..df3d23960 --- /dev/null +++ b/test/shaping/hb-unicode-decode @@ -0,0 +1,19 @@ +#!/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): + print "Usage:\n %s [UNICODE_STRING]...\nor:\n %s --stdin" % (sys.argv[0], sys.argv[0]) + 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:]))