--- /dev/null
+#!/usr/bin/python
+#-*-coding: utf8-*-
+
+import io
+import sys
+
+def gen_ent(mail):
+ for char in mail:
+ ent = "".join(['&#', `ord(char)`, ';'])
+ yield ent
+
+def main(inp):
+ for mail in inp:
+ print mail,":", "".join(gen_ent(mail))
+
+if __name__ == "__main__":
+ if len(sys.argv) == 1:
+ inp = []
+ for mail in str.split(sys.__stdin__.read()):
+ inp.append(mail)
+ if len(inp) == 0:
+ print "Error: Please use either stdin or $1 for string input!"
+ else:
+ main(inp)
+ else:
+ main(sys.argv[1:])