Refactored existing functions. Added Unicode support and UTF-8, UTF-16, and UTF-32 encoding/decoding.
This is a follow-up to previous commit.