#!/usr/bin/python

import htmlentitydefs

print "non_ascii_replacements = {"
for entname, entnum in htmlentitydefs.name2codepoint.items():
    if entnum < 128:
        pass # don't bother converting, they're already ascii
    elif entnum < 256:
        print '"\\x%02x": "&%s;",' % (entnum, entname)
    else:
        print '"\\u%04x": "&%s;",' % (entnum, entname)
print "};"