1#!/usr/bin/python 2 3# Copyright 2016 Google Inc. 4# 5# Use of this source code is governed by a BSD-style license that can be 6# found in the LICENSE file. 7 8import array, zlib, base64, sys 9 10## Source: http://www.unicode.org/Public/9.0.0/ucd/UnicodeData.txt 11valid_codepoint_data = ''' 12 eNrt3buPG0UcwHHPeNf22b67hPBIUpAc0iEgElAgIkSRXEkXUVOcKKj5F6BFQpSUqSgpkUAU+Rco 13 +Av4PyLicD6ZzT5mZmfmtzPz/UhWFJ/X8356H/dmkHJGFgAAAADe6I73q55j1NXLJ0VRAAASHzN0 14 ouOcaol/zuPyKmJYdct7G9oMANqv01gKGScFpbUusN0ogbheCPSVb9KUkfFcQAceQ9XA3+YOfVJX 15 nHdrtaon3FBprA3SWwnnc9u/uuO4trjuymnZ8r3LkfHeWI4pKsIYZJOXLvWrKw27409H1tllo0ym 16 3v7H5GVb3FeNOhyyH1gPpHHekw/zg/dV4715x3eYqCzjscuLRaD5em05FsVo2z6+ez4iHcuW92vH 17 +rnynO6p5b9r2zXJ/2VHW7CJ18kE8zbW2tAkPZXg+tQlHF/lMg8cX9N5kh6IY9Vz7FAYC4cy3Bay 18 5qoEwjxvKXd1ML7bzskO68GY9qEG2nNfXdOO/cR9lv1B5z85tJdU80pFPvac5gK0tqV6xm+PAFDS 19 fHno3E3XfaVU0lhCvivqddGk82IeKZwFRR21/tDGAAAAkMtaomQu58H27TGEvO7zyPP3bUemXY34 20 HoRbqzYtPH/Otk34CgPDVgnFtaa4Wq0Fw7bdP68cPp/KvEZHHt9DiHWOlk2/Xuq8lj1kmd/ndIB6 21 vBCoAxdUn0n2faz5kcN8XLr+llb3HyZcdxTreSBb7M0AkFyf68ziqxqvqcU/ZUrgWB0gLn1hqMD5 22 gGnUTT3xdiO5Tr85gfI8pUrDQkUWAAAAZLt2i+mOxWffoCgBAAAAAAAAAAAAdNCFh79ney7s0O/J 23 dxv/v5FwHVHEHXipTrQNlPCspP09IE8Ch3Pk2N/k8DfI+JzxMhvcZxXw767l50u/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Xgc837PllozPS8z/21xE8r/32nqcN+VFuE3fY72+61 38 uEqXmr36W2tbWKrls2pm9zuvMoybS7rGlr8KFMYnV/+eJPZjZUX3MClboTFFCR0biss5t5KX7Zd2 39 jkOJ/c5nAmEeZ1gv9svJXxkuAAAAAACw4rJP0LdfdkSWZmVLFnj3wPLzue+Zrgw/t8gkHb59PeJY 40 ZZAm7fk7fdZvX49j+fDF69Fz+iYAABDHP/Vm9jbZIOpfwWoh0w== 41''' 42if sys.version_info[0] < 3: 43 def to_unicode(i): 44 return ('\U%08x' % i).decode('unicode-escape').encode('UTF-8') 45else: 46 def to_unicode(i): 47 return chr(i) 48o = sys.stdout 49o.write(to_unicode(0xFEFF)) 50pack = array.array('I', zlib.decompress( 51 base64.b64decode(valid_codepoint_data))) 52i = 0 53last_row = -1 54plist = pack.tolist() 55for increment in plist: 56 i += increment + 1 57 row = i - (i & 63) 58 if last_row != row: 59 if row: 60 o.write('\n' if row % 1024 else '\n\n') 61 o.write('U+%06x ' % row) 62 last_row = row 63 o.write(' ' + to_unicode(i)) 64o.write('\n') 65