Common support for ASCII, UTF8 and UTF16 character encodings