Fixed bugs introduced by UTF-8 support (commit 28ee7c95bca46ad3cdb965741c5c29e21c50df14) and added tests that revealed them.

Bugs:
1) dot broken in EBCDIC mode
2) ranges that have 1-2 symbols (without "-") considered empty