#!/usr/bin/env python
# -*- coding: latin-1 -*-
#########################################
# ucharstable                           #
#   Envoie sur la sortie standard un    #
#   tableau des caractères Unicode HTML #
# (c) Olivier Pirson ------- DragonSoft #
# http://www.opimedia.be/DS/            #
# Débuté le 3 avril 2007                ############
# v.01.00 --- 4 avril 2007                         #
#         --- 20 février 2008                      #
#         --- 19 mai 2008                          #
# v.01.01 --- 28 septembre 2009 : nouveau site web #
#         --- 15 mars 2010 : nouveau site web      #
#         --- 2 janvier 2012 : nouveau site web    #
####################################################
VERSION = 'v.01.01 --- 2012 January 2'

if __name__ == '__main__':
    w = 20
    to = 2**16 - 1

    print '<table border="1" cellspacing="0" summary="uchars 0 to %u">' % to

    l = ['<tr><th></th>']
    for x in range(w):
        l.append('<th>%u</th>' % x)
    l.append('</tr>')
    print ''.join(l)

    y = 0
    while w*y <= to:
        l = ['<tr><th align="right">%u&nbsp;</th>' % (w*y)]
        for x in range(w):
            if w*y + x > to:
                break
            l.append('<td>&#%u;</td>' % (w*y + x))
        l.append('</tr>')
        print ''.join(l)
        y += 1

    print '</table>'
