Adds handling of non-ASCII characters.
Unicode characters no longer cause the script to terminate.