added unicode support

A bit of hackery thanks to the Unicode support in JavaScript and Python :)

Tested locally and it works with Serbian (both Latin and Cyrillic script) and
Chinese (both Traditional and simplified).  Unfortunately, creating a tire is now
slower, but the Unicode support is, IMO, worth it. Great job, btw.