Improve type safety
Convert lexer and scanner to use Unicode
Revert "Convert most internal structures to UTF-16"

This reverts commit 478ee83f2f9fd25bfe90bab08bbbf73934899b73.
Merge branch 'old'