From a75ed08490c81689a468f9fb9b5e2111ef090519 Mon Sep 17 00:00:00 2001
From: magnum <magnum>
Date: Wed, 21 Sep 2011 00:55:52 +0200
Subject: [PATCH] Move options parsing so --enc=list works. Add encodings 8859-7 and cp1253.
 "Sort" encodings within JtR code and in output.

---
 src/encoding_data.h |  393 ++++++++++++++++++++++++++++++++------------------
 src/options.c       |  147 +++++++++++---------
 src/options.h       |   12 +-
 src/rules.c         |  240 ++++++++++++++++++-------------
 src/unicode.c       |  134 ++++++++++--------
 5 files changed, 556 insertions(+), 370 deletions(-)

diff --git a/src/encoding_data.h b/src/encoding_data.h
index 54ae3ff..c5601fa 100644
--- a/src/encoding_data.h
+++ b/src/encoding_data.h
@@ -68,125 +68,60 @@ static UTF16 ISO_8859_1_to_unicode_high128[] = {
 	"\x59\x79\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFF"
 #define CHARS_CONSONANTS_ISO_8859_1 "\xAA\xB5\xBA\xC7\xD0\xD1\xDD\xDE\xDF\xE7\xF0\xF1\xFD\xFE\xFF"
 
-// here is the KOI8_R to Unicode conversion for KOI8_R characters from 0x80 to 0xFF
-static UTF16 KOI8_R_to_unicode_high128[] = {
-0x2500,0x2502,0x250C,0x2510,0x2514,0x2518,0x251C,0x2524,0x252C,0x2534,0x253C,0x2580,0x2584,0x2588,0x258C,0x2590,
-0x2591,0x2592,0x2593,0x2320,0x25A0,0x2219,0x221A,0x2248,0x2264,0x2265,0x00A0,0x2321,0x00B0,0x00B2,0x00B7,0x00F7,
-0x2550,0x2551,0x2552,0x0451,0x2553,0x2554,0x2555,0x2556,0x2557,0x2558,0x2559,0x255A,0x255B,0x255C,0x255D,0x255E,
-0x255F,0x2560,0x2561,0x0401,0x2562,0x2563,0x2564,0x2565,0x2566,0x2567,0x2568,0x2569,0x256A,0x256B,0x256C,0x00A9,
-0x044E,0x0430,0x0431,0x0446,0x0434,0x0435,0x0444,0x0433,0x0445,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,
-0x043F,0x044F,0x0440,0x0441,0x0442,0x0443,0x0436,0x0432,0x044C,0x044B,0x0437,0x0448,0x044D,0x0449,0x0447,0x044A,
-0x042E,0x0410,0x0411,0x0426,0x0414,0x0415,0x0424,0x0413,0x0425,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,
-0x041F,0x042F,0x0420,0x0421,0x0422,0x0423,0x0416,0x0412,0x042C,0x042B,0x0417,0x0428,0x042D,0x0429,0x0427,0x042A };
-#define CHARS_LOWER_KOI8_R \
-	"\xA3\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF"
-#define CHARS_LOW_ONLY_KOI8_R
-#define CHARS_UPPER_KOI8_R \
-	"\xB3\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
-#define CHARS_UP_ONLY_KOI8_R
-#define CHARS_DIGITS_KOI8_R "\x9D"
-#define CHARS_PUNCTUATION_KOI8_R "\x9E"
-#define CHARS_SPECIALS_KOI8_R \
-	"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9B\x9C\x9F\xA0\xA1\xA2\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF"
-#define CHARS_ALPHA_KOI8_R \
-	"\xA3\xB3\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
-#define CHARS_WHITESPACE_KOI8_R "\x9A"
-#define CHARS_CONTROL_KOI8_R
-#define CHARS_INVALID_KOI8_R ""
-#define CHARS_VOWELS_KOI8_R \
-	"\x59\x79\xA3\xB3\xC0\xC1\xC5\xC9\xCA\xCF\xD1\xD5\xD9\xDC\xE0\xE1\xE5\xE9\xEA\xEF\xF1\xF5\xF9\xFC"
-#define CHARS_CONSONANTS_KOI8_R \
-	"\xC2\xC3\xC4\xC6\xC7\xC8\xCB\xCC\xCD\xCE\xD0\xD2\xD3\xD4\xD6\xD7\xD8\xDA\xDB\xDD\xDE\xDF\xE2\xE3\xE4\xE6\xE7\xE8\xEB\xEC\xED\xEE\xF0\xF2\xF3\xF4\xF6\xF7\xF8\xFA\xFB\xFD\xFE\xFF"
+// here is the ISO_8859_7 to Unicode conversion for ISO_8859_7 characters from 0x80 to 0xFF
+static UTF16 ISO_8859_7_to_unicode_high128[] = {
+0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,
+0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,
+0x00A0,0x2018,0x2019,0x00A3,0x20AC,0x20AF,0x00A6,0x00A7,0x00A8,0x00A9,0x037A,0x00AB,0x00AC,0x00AD,0x00AE,0x2015,
+0x00B0,0x00B1,0x00B2,0x00B3,0x0384,0x0385,0x0386,0x00B7,0x0388,0x0389,0x038A,0x00BB,0x038C,0x00BD,0x038E,0x038F,
+0x0390,0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,
+0x03A0,0x03A1,0x00D2,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,0x03A8,0x03A9,0x03AA,0x03AB,0x03AC,0x03AD,0x03AE,0x03AF,
+0x03B0,0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,0x03B8,0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,
+0x03C0,0x03C1,0x03C2,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,0x03C9,0x03CA,0x03CB,0x03CC,0x03CD,0x03CE,0x00FF };
+// *** WARNING, char at 0xC0 U+0390 (ΐ -> Ϊ́) needs to be looked into.  Single to multi-byte conversion
+// *** WARNING, char at 0xE0 U+03B0 (ΰ -> Ϋ́) needs to be looked into.  Single to multi-byte conversion
 
-// here is the CP1251 to Unicode conversion for CP1251 characters from 0x80 to 0xFF
-static UTF16 CP1251_to_unicode_high128[] = {
-0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021,0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
-0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,0x0098,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F,
-0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7,0x0401,0x00A9,0x0404,0x00AB,0x00AC,0x00AD,0x00AE,0x0407,
-0x00B0,0x00B1,0x0406,0x0456,0x0491,0x00B5,0x00B6,0x00B7,0x0451,0x2116,0x0454,0x00BB,0x0458,0x0405,0x0455,0x0457,
-0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F,
-0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427,0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F,
-0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F,
-0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447,0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F };
-#define CHARS_LOWER_CP1251 \
-	"\x83\x90\x9A\x9C\x9D\x9E\x9F\xA2\xB3\xB4\xB8\xBA\xBC\xBE\xBF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
-#define CHARS_LOW_ONLY_CP1251 "\xB5"
-#define CHARS_UPPER_CP1251 \
-	"\x81\x80\x8A\x8C\x8D\x8E\x8F\xA1\xB2\xA5\xA8\xAA\xA3\xBD\xAF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF"
-#define CHARS_UP_ONLY_CP1251
-#define CHARS_DIGITS_CP1251
-#define CHARS_PUNCTUATION_CP1251 "\x82\x84\x85\x86\x87\x89\x8B\x91\x92\x93\x94\x95\x96\x97\x9B\xAB\xB7\xBB"
-#define CHARS_SPECIALS_CP1251 "\x88\x99\xA4\xA6\xA7\xA9\xAC\xAD\xAE\xB0\xB1\xB6\xB9"
-#define CHARS_ALPHA_CP1251 \
-	"\x80\x81\x83\x8A\x8C\x8D\x8E\x8F\x90\x9A\x9C\x9D\x9E\x9F\xA1\xA2\xA3\xA5\xA8\xAA\xAF\xB2\xB3\xB4\xB5\xB8\xBA\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
-#define CHARS_WHITESPACE_CP1251 "\xA0"
-#define CHARS_CONTROL_CP1251
-#define CHARS_INVALID_CP1251 "\x98"
-#define CHARS_VOWELS_CP1251 \
-	"\x59\x79\xA1\xA2\xA8\xAA\xAF\xB2\xB3\xB8\xBA\xBF\xC0\xC5\xC8\xC9\xCE\xD3\xDB\xDD\xDE\xDF\xE0\xE5\xE8\xE9\xEE\xF3\xFB\xFD\xFE\xFF"
-#define CHARS_CONSONANTS_CP1251 \
-	"\x80\x81\x83\x8A\x8C\x8D\x8E\x8F\x90\x9A\x9C\x9D\x9E\x9F\xA3\xA5\xB4\xB5\xBC\xBD\xBE\xC1\xC2\xC3\xC4\xC6\xC7\xCA\xCB\xCC\xCD\xCF\xD0\xD1\xD2\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDC\xE1\xE2\xE3\xE4\xE6\xE7\xEA\xEB\xEC\xED\xEF\xF0\xF1\xF2\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFC"
+// άέήίαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ
+#define CHARS_LOWER_ISO_8859_7 \
+	"\xDC\xDD\xDE\xDF\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE"
 
-// here is the CP866 to Unicode conversion for CP866 characters from 0x80 to 0xFF
-static UTF16 CP866_to_unicode_high128[] = {
-0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F,
-0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427,0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F,
-0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F,
-0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255D,0x255C,0x255B,0x2510,
-0x2514,0x2534,0x252C,0x251C,0x2500,0x253C,0x255E,0x255F,0x255A,0x2554,0x2569,0x2566,0x2560,0x2550,0x256C,0x2567,
-0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256B,0x256A,0x2518,0x250C,0x2588,0x2584,0x258C,0x2590,0x2580,
-0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447,0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F,
-0x0401,0x0451,0x0404,0x0454,0x0407,0x0457,0x040E,0x045E,0x00B0,0x2219,0x00B7,0x221A,0x2116,0x00A4,0x25A0,0x00A0 };
-#define CHARS_LOWER_CP866 \
-	"\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF1\xF3\xF5\xF7"
-#define CHARS_LOW_ONLY_CP866
-#define CHARS_UPPER_CP866 \
-	"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xF0\xF2\xF4\xF6"
-#define CHARS_UP_ONLY_CP866
-#define CHARS_DIGITS_CP866
-#define CHARS_PUNCTUATION_CP866 "\xFA"
-#define CHARS_SPECIALS_CP866 \
-	"\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xF8\xF9\xFB\xFC\xFD\xFE"
-#define CHARS_ALPHA_CP866 \
-	"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7"
-#define CHARS_WHITESPACE_CP866 "\xFF"
-#define CHARS_CONTROL_CP866
-#define CHARS_INVALID_CP866 ""
-#define CHARS_VOWELS_CP866 \
-	"\x59\x79\x80\x85\x88\x89\x8E\x93\x9B\x9D\x9E\x9F\xA0\xA5\xA8\xA9\xAE\xE3\xEB\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7"
-#define CHARS_CONSONANTS_CP866 \
-	"\x81\x82\x83\x84\x86\x87\x8A\x8B\x8C\x8D\x8F\x90\x91\x92\x94\x95\x96\x97\x98\x99\x9A\x9C\xA1\xA2\xA3\xA4\xA6\xA7\xAA\xAB\xAC\xAD\xAF\xE0\xE1\xE2\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEC"
+// ΐΰ
+#define CHARS_LOW_ONLY_ISO_8859_7 "\xC0\xE0"
 
-// here is the CP1252 to Unicode conversion for CP1252 characters from 0x80 to 0xFF
-static UTF16 CP1252_to_unicode_high128[] = {
-0x20AC,0x0081,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021,0x02C6,0x2030,0x0160,0x2039,0x0152,0x008D,0x017D,0x008F,
-0x0090,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,0x02DC,0x2122,0x0161,0x203A,0x0153,0x009D,0x017E,0x0178,
-0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
-0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
-0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
-0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
-0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
-0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF };
-// *** WARNING, char at 0xDF U+00DF (ß -> SS) needs to be looked into.  Single to multi-byte conversion
-#define CHARS_LOWER_CP1252 \
-	"\x9A\x9C\x9E\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
-#define CHARS_LOW_ONLY_CP1252 "\x83\xAA\xB5\xBA\xDF"
-#define CHARS_UPPER_CP1252 \
-	"\x8A\x8C\x8E\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\x9F"
-#define CHARS_UP_ONLY_CP1252
-#define CHARS_DIGITS_CP1252 "\xB2\xB3\xB9\xBC\xBD\xBE"
-#define CHARS_PUNCTUATION_CP1252 "\x82\x84\x85\x86\x87\x89\x8B\x91\x92\x93\x94\x95\x96\x97\x9B\xA1\xAB\xB7\xBB\xBF"
-#define CHARS_SPECIALS_CP1252 \
-	"\x80\x88\x98\x99\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAC\xAD\xAE\xAF\xB0\xB1\xB4\xB6\xB8\xD7\xF7"
-#define CHARS_ALPHA_CP1252 \
-	"\x83\x8A\x8C\x8E\x9A\x9C\x9E\x9F\xAA\xB5\xBA\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
-#define CHARS_WHITESPACE_CP1252 "\xA0"
-#define CHARS_CONTROL_CP1252
-#define CHARS_INVALID_CP1252 "\x81\x8D\x8F\x90\x9D"
-#define CHARS_VOWELS_CP1252 \
-	"\x59\x79\x8C\x9C\x9F\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFF"
-#define CHARS_CONSONANTS_CP1252 \
-	"\x83\x8A\x8E\x9A\x9E\x9F\xAA\xB5\xBA\xC7\xD0\xD1\xDD\xDE\xDF\xE7\xF0\xF1\xFD\xFE\xFF"
+// ΆΈΉΊΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΣΤΥΦΧΨΩΪΫΌΎΏ
+#define CHARS_UPPER_ISO_8859_7 \
+	"\xB6\xB8\xB9\xBA\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD3\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xBC\xBE\xBF"
+
+//
+#define CHARS_UP_ONLY_ISO_8859_7
+
+// ²³½
+#define CHARS_DIGITS_ISO_8859_7 "\xB2\xB3\xBD"
+
+// ‘’«―·»
+#define CHARS_PUNCTUATION_ISO_8859_7 "\xA1\xA2\xAB\xAF\xB7\xBB"
+
+// £€₯¦§¨©ͺ¬­°±΄΅
+#define CHARS_SPECIALS_ISO_8859_7 "\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAC\xAD\xB0\xB1\xB4\xB5"
+
+// ΆΈΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ
+#define CHARS_ALPHA_ISO_8859_7 \
+	"\xB6\xB8\xB9\xBA\xBC\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE"
+
+#define CHARS_WHITESPACE_ISO_8859_7 "\xA0"
+
+#define CHARS_CONTROL_ISO_8859_7 \
+	"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F"
+
+#define CHARS_INVALID_ISO_8859_7 "\xAE\xD2\xFF"
+
+// YyΆΈΉΊΌΎΏΐΑΕΗΙΟΥΩΪΫάέήίΰαεηιουωϊϋόύώ
+#define CHARS_VOWELS_ISO_8859_7 \
+	"\x59\x79\xB6\xB8\xB9\xBA\xBC\xBE\xBF\xC0\xC1\xC5\xC7\xC9\xCF\xD5\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE5\xE7\xE9\xEF\xF5\xF9\xFA\xFB\xFC\xFD\xFE"
+
+// ΒΓΔΖΘΚΛΜΝΞΠΡΣΤΦΧΨβγδζθκλμνξπρςστφχψ
+#define CHARS_CONSONANTS_ISO_8859_7 \
+	"\xC2\xC3\xC4\xC6\xC8\xCA\xCB\xCC\xCD\xCE\xD0\xD1\xD3\xD4\xD6\xD7\xD8\xE2\xE3\xE4\xE6\xE8\xEA\xEB\xEC\xED\xEE\xF0\xF1\xF2\xF3\xF4\xF6\xF7\xF8"
 
 // here is the ISO_8859_15 to Unicode conversion for ISO_8859_15 characters from 0x80 to 0xFF
 static UTF16 ISO_8859_15_to_unicode_high128[] = {
@@ -218,6 +153,36 @@ static UTF16 ISO_8859_15_to_unicode_high128[] = {
 	"\x59\x79\xBC\xBD\xBE\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFF"
 #define CHARS_CONSONANTS_ISO_8859_15 "\xA6\xA8\xAA\xB4\xB5\xB8\xBA\xBE\xC7\xD0\xD1\xDD\xDE\xDF\xE7\xF0\xF1\xFD\xFE\xFF"
 
+// here is the KOI8_R to Unicode conversion for KOI8_R characters from 0x80 to 0xFF
+static UTF16 KOI8_R_to_unicode_high128[] = {
+0x2500,0x2502,0x250C,0x2510,0x2514,0x2518,0x251C,0x2524,0x252C,0x2534,0x253C,0x2580,0x2584,0x2588,0x258C,0x2590,
+0x2591,0x2592,0x2593,0x2320,0x25A0,0x2219,0x221A,0x2248,0x2264,0x2265,0x00A0,0x2321,0x00B0,0x00B2,0x00B7,0x00F7,
+0x2550,0x2551,0x2552,0x0451,0x2553,0x2554,0x2555,0x2556,0x2557,0x2558,0x2559,0x255A,0x255B,0x255C,0x255D,0x255E,
+0x255F,0x2560,0x2561,0x0401,0x2562,0x2563,0x2564,0x2565,0x2566,0x2567,0x2568,0x2569,0x256A,0x256B,0x256C,0x00A9,
+0x044E,0x0430,0x0431,0x0446,0x0434,0x0435,0x0444,0x0433,0x0445,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,
+0x043F,0x044F,0x0440,0x0441,0x0442,0x0443,0x0436,0x0432,0x044C,0x044B,0x0437,0x0448,0x044D,0x0449,0x0447,0x044A,
+0x042E,0x0410,0x0411,0x0426,0x0414,0x0415,0x0424,0x0413,0x0425,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,
+0x041F,0x042F,0x0420,0x0421,0x0422,0x0423,0x0416,0x0412,0x042C,0x042B,0x0417,0x0428,0x042D,0x0429,0x0427,0x042A };
+#define CHARS_LOWER_KOI8_R \
+	"\xA3\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF"
+#define CHARS_LOW_ONLY_KOI8_R
+#define CHARS_UPPER_KOI8_R \
+	"\xB3\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
+#define CHARS_UP_ONLY_KOI8_R
+#define CHARS_DIGITS_KOI8_R "\x9D"
+#define CHARS_PUNCTUATION_KOI8_R "\x9E"
+#define CHARS_SPECIALS_KOI8_R \
+	"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9B\x9C\x9F\xA0\xA1\xA2\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF"
+#define CHARS_ALPHA_KOI8_R \
+	"\xA3\xB3\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
+#define CHARS_WHITESPACE_KOI8_R "\x9A"
+#define CHARS_CONTROL_KOI8_R
+#define CHARS_INVALID_KOI8_R ""
+#define CHARS_VOWELS_KOI8_R \
+	"\x59\x79\xA3\xB3\xC0\xC1\xC5\xC9\xCA\xCF\xD1\xD5\xD9\xDC\xE0\xE1\xE5\xE9\xEA\xEF\xF1\xF5\xF9\xFC"
+#define CHARS_CONSONANTS_KOI8_R \
+	"\xC2\xC3\xC4\xC6\xC7\xC8\xCB\xCC\xCD\xCE\xD0\xD2\xD3\xD4\xD6\xD7\xD8\xDA\xDB\xDD\xDE\xDF\xE2\xE3\xE4\xE6\xE7\xE8\xEB\xEC\xED\xEE\xF0\xF2\xF3\xF4\xF6\xF7\xF8\xFA\xFB\xFD\xFE\xFF"
+
 // here is the CP437 to Unicode conversion for CP437 characters from 0x80 to 0xFF
 static UTF16 CP437_to_unicode_high128[] = {
 0x00C7,0x00FC,0x00E9,0x00E2,0x00E4,0x00E0,0x00E5,0x00E7,0x00EA,0x00EB,0x00E8,0x00EF,0x00EE,0x00EC,0x00C4,0x00C5,
@@ -247,6 +212,36 @@ static UTF16 CP437_to_unicode_high128[] = {
 	"\x59\x79\x81\x82\x83\x84\x85\x86\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\xA0\xA1\xA2\xA3\xE0\xEA\xEE"
 #define CHARS_CONSONANTS_CP437 "\x80\x87\x98\x9F\xA4\xA5\xA6\xA7\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEB\xED"
 
+// here is the CP737 to Unicode conversion for CP737 characters from 0x80 to 0xFF
+static UTF16 CP737_to_unicode_high128[] = {
+0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,0x03A0,
+0x03A1,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,0x03A8,0x03A9,0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,0x03B8,
+0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,0x03C0,0x03C1,0x03C3,0x03C2,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,
+0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255D,0x255C,0x255B,0x2510,
+0x2514,0x2534,0x252C,0x251C,0x2500,0x253C,0x255E,0x255F,0x255A,0x2554,0x2569,0x2566,0x2560,0x2550,0x256C,0x2567,
+0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256B,0x256A,0x2518,0x250C,0x2588,0x2584,0x258C,0x2590,0x2580,
+0x03C9,0x03AC,0x03AD,0x03AE,0x03CA,0x03AF,0x03CC,0x03CD,0x03CB,0x03CE,0x0386,0x0388,0x0389,0x038A,0x038C,0x038E,
+0x038F,0x00B1,0x2265,0x2264,0x03AA,0x03AB,0x00F7,0x2248,0x00B0,0x2219,0x00B7,0x221A,0x207F,0x00B2,0x25A0,0x00A0 };
+#define CHARS_LOWER_CP737 \
+	"\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9"
+#define CHARS_LOW_ONLY_CP737
+#define CHARS_UPPER_CP737 \
+	"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x91\x92\x93\x94\x95\x96\x97\xEA\xEB\xEC\xF4\xED\xEE\xEF\xF5\xF0"
+#define CHARS_UP_ONLY_CP737
+#define CHARS_DIGITS_CP737 "\xFD"
+#define CHARS_PUNCTUATION_CP737 "\xFA"
+#define CHARS_SPECIALS_CP737 \
+	"\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xF1\xF2\xF3\xF6\xF7\xF8\xF9\xFB\xFC\xFE"
+#define CHARS_ALPHA_CP737 \
+	"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF4\xF5"
+#define CHARS_WHITESPACE_CP737 "\xFF"
+#define CHARS_CONTROL_CP737
+#define CHARS_INVALID_CP737 ""
+#define CHARS_VOWELS_CP737 \
+	"\x59\x79\x80\x84\x86\x88\x8E\x93\x97\x98\x9C\x9E\xA0\xA6\xAC\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF4\xF5"
+#define CHARS_CONSONANTS_CP737 \
+	"\x81\x82\x83\x85\x87\x89\x8A\x8B\x8C\x8D\x8F\x90\x91\x92\x94\x95\x96\x99\x9A\x9B\x9D\x9F\xA1\xA2\xA3\xA4\xA5\xA7\xA8\xA9\xAA\xAB\xAD\xAE\xAF"
+
 // here is the CP850 to Unicode conversion for CP850 characters from 0x80 to 0xFF
 static UTF16 CP850_to_unicode_high128[] = {
 0x00C7,0x00FC,0x00E9,0x00E2,0x00E4,0x00E0,0x00E5,0x00E7,0x00EA,0x00EB,0x00E8,0x00EF,0x00EE,0x00EC,0x00C4,0x00C5,
@@ -308,35 +303,149 @@ static UTF16 CP858_to_unicode_high128[] = {
 	"\x59\x79\x81\x82\x83\x84\x85\x86\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9D\xA0\xA1\xA2\xA3\xB5\xB6\xB7\xC6\xC7\xD2\xD3\xD4\xD6\xD7\xD8\xDE\xE0\xE2\xE3\xE4\xE5\xE9\xEA\xEB\xEC\xED"
 #define CHARS_CONSONANTS_CP858 "\x80\x87\x98\x9F\xA4\xA5\xA6\xA7\xD0\xD1\xE1\xE6\xE7\xE8\xEC\xED"
 
-// here is the CP737 to Unicode conversion for CP737 characters from 0x80 to 0xFF
-static UTF16 CP737_to_unicode_high128[] = {
-0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,0x03A0,
-0x03A1,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,0x03A8,0x03A9,0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,0x03B8,
-0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,0x03C0,0x03C1,0x03C3,0x03C2,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,
+// here is the CP866 to Unicode conversion for CP866 characters from 0x80 to 0xFF
+static UTF16 CP866_to_unicode_high128[] = {
+0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F,
+0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427,0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F,
+0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F,
 0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255D,0x255C,0x255B,0x2510,
 0x2514,0x2534,0x252C,0x251C,0x2500,0x253C,0x255E,0x255F,0x255A,0x2554,0x2569,0x2566,0x2560,0x2550,0x256C,0x2567,
 0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256B,0x256A,0x2518,0x250C,0x2588,0x2584,0x258C,0x2590,0x2580,
-0x03C9,0x03AC,0x03AD,0x03AE,0x03CA,0x03AF,0x03CC,0x03CD,0x03CB,0x03CE,0x0386,0x0388,0x0389,0x038A,0x038C,0x038E,
-0x038F,0x00B1,0x2265,0x2264,0x03AA,0x03AB,0x00F7,0x2248,0x00B0,0x2219,0x00B7,0x221A,0x207F,0x00B2,0x25A0,0x00A0 };
-#define CHARS_LOWER_CP737 \
-	"\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9"
-#define CHARS_LOW_ONLY_CP737
-#define CHARS_UPPER_CP737 \
-	"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x91\x92\x93\x94\x95\x96\x97\xEA\xEB\xEC\xF4\xED\xEE\xEF\xF5\xF0"
-#define CHARS_UP_ONLY_CP737
-#define CHARS_DIGITS_CP737 "\xFD"
-#define CHARS_PUNCTUATION_CP737 "\xFA"
-#define CHARS_SPECIALS_CP737 \
-	"\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xF1\xF2\xF3\xF6\xF7\xF8\xF9\xFB\xFC\xFE"
-#define CHARS_ALPHA_CP737 \
-	"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF4\xF5"
-#define CHARS_WHITESPACE_CP737 "\xFF"
-#define CHARS_CONTROL_CP737
-#define CHARS_INVALID_CP737 ""
-#define CHARS_VOWELS_CP737 \
-	"\x59\x79\x80\x84\x86\x88\x8E\x93\x97\x98\x9C\x9E\xA0\xA6\xAC\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF4\xF5"
-#define CHARS_CONSONANTS_CP737 \
-	"\x81\x82\x83\x85\x87\x89\x8A\x8B\x8C\x8D\x8F\x90\x91\x92\x94\x95\x96\x99\x9A\x9B\x9D\x9F\xA1\xA2\xA3\xA4\xA5\xA7\xA8\xA9\xAA\xAB\xAD\xAE\xAF"
+0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447,0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F,
+0x0401,0x0451,0x0404,0x0454,0x0407,0x0457,0x040E,0x045E,0x00B0,0x2219,0x00B7,0x221A,0x2116,0x00A4,0x25A0,0x00A0 };
+#define CHARS_LOWER_CP866 \
+	"\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF1\xF3\xF5\xF7"
+#define CHARS_LOW_ONLY_CP866
+#define CHARS_UPPER_CP866 \
+	"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xF0\xF2\xF4\xF6"
+#define CHARS_UP_ONLY_CP866
+#define CHARS_DIGITS_CP866
+#define CHARS_PUNCTUATION_CP866 "\xFA"
+#define CHARS_SPECIALS_CP866 \
+	"\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xF8\xF9\xFB\xFC\xFD\xFE"
+#define CHARS_ALPHA_CP866 \
+	"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7"
+#define CHARS_WHITESPACE_CP866 "\xFF"
+#define CHARS_CONTROL_CP866
+#define CHARS_INVALID_CP866 ""
+#define CHARS_VOWELS_CP866 \
+	"\x59\x79\x80\x85\x88\x89\x8E\x93\x9B\x9D\x9E\x9F\xA0\xA5\xA8\xA9\xAE\xE3\xEB\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7"
+#define CHARS_CONSONANTS_CP866 \
+	"\x81\x82\x83\x84\x86\x87\x8A\x8B\x8C\x8D\x8F\x90\x91\x92\x94\x95\x96\x97\x98\x99\x9A\x9C\xA1\xA2\xA3\xA4\xA6\xA7\xAA\xAB\xAC\xAD\xAF\xE0\xE1\xE2\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEC"
+
+// here is the CP1251 to Unicode conversion for CP1251 characters from 0x80 to 0xFF
+static UTF16 CP1251_to_unicode_high128[] = {
+0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021,0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
+0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,0x0098,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F,
+0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7,0x0401,0x00A9,0x0404,0x00AB,0x00AC,0x00AD,0x00AE,0x0407,
+0x00B0,0x00B1,0x0406,0x0456,0x0491,0x00B5,0x00B6,0x00B7,0x0451,0x2116,0x0454,0x00BB,0x0458,0x0405,0x0455,0x0457,
+0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F,
+0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427,0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F,
+0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F,
+0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447,0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F };
+#define CHARS_LOWER_CP1251 \
+	"\x83\x90\x9A\x9C\x9D\x9E\x9F\xA2\xB3\xB4\xB8\xBA\xBC\xBE\xBF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
+#define CHARS_LOW_ONLY_CP1251 "\xB5"
+#define CHARS_UPPER_CP1251 \
+	"\x81\x80\x8A\x8C\x8D\x8E\x8F\xA1\xB2\xA5\xA8\xAA\xA3\xBD\xAF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF"
+#define CHARS_UP_ONLY_CP1251
+#define CHARS_DIGITS_CP1251
+#define CHARS_PUNCTUATION_CP1251 "\x82\x84\x85\x86\x87\x89\x8B\x91\x92\x93\x94\x95\x96\x97\x9B\xAB\xB7\xBB"
+#define CHARS_SPECIALS_CP1251 "\x88\x99\xA4\xA6\xA7\xA9\xAC\xAD\xAE\xB0\xB1\xB6\xB9"
+#define CHARS_ALPHA_CP1251 \
+	"\x80\x81\x83\x8A\x8C\x8D\x8E\x8F\x90\x9A\x9C\x9D\x9E\x9F\xA1\xA2\xA3\xA5\xA8\xAA\xAF\xB2\xB3\xB4\xB5\xB8\xBA\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
+#define CHARS_WHITESPACE_CP1251 "\xA0"
+#define CHARS_CONTROL_CP1251
+#define CHARS_INVALID_CP1251 "\x98"
+#define CHARS_VOWELS_CP1251 \
+	"\x59\x79\xA1\xA2\xA8\xAA\xAF\xB2\xB3\xB8\xBA\xBF\xC0\xC5\xC8\xC9\xCE\xD3\xDB\xDD\xDE\xDF\xE0\xE5\xE8\xE9\xEE\xF3\xFB\xFD\xFE\xFF"
+#define CHARS_CONSONANTS_CP1251 \
+	"\x80\x81\x83\x8A\x8C\x8D\x8E\x8F\x90\x9A\x9C\x9D\x9E\x9F\xA3\xA5\xB4\xB5\xBC\xBD\xBE\xC1\xC2\xC3\xC4\xC6\xC7\xCA\xCB\xCC\xCD\xCF\xD0\xD1\xD2\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDC\xE1\xE2\xE3\xE4\xE6\xE7\xEA\xEB\xEC\xED\xEF\xF0\xF1\xF2\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFC"
+
+// here is the CP1252 to Unicode conversion for CP1252 characters from 0x80 to 0xFF
+static UTF16 CP1252_to_unicode_high128[] = {
+0x20AC,0x0081,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021,0x02C6,0x2030,0x0160,0x2039,0x0152,0x008D,0x017D,0x008F,
+0x0090,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,0x02DC,0x2122,0x0161,0x203A,0x0153,0x009D,0x017E,0x0178,
+0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
+0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
+0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
+0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
+0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
+0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF };
+// *** WARNING, char at 0xDF U+00DF (ß -> SS) needs to be looked into.  Single to multi-byte conversion
+#define CHARS_LOWER_CP1252 \
+	"\x9A\x9C\x9E\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
+#define CHARS_LOW_ONLY_CP1252 "\x83\xAA\xB5\xBA\xDF"
+#define CHARS_UPPER_CP1252 \
+	"\x8A\x8C\x8E\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\x9F"
+#define CHARS_UP_ONLY_CP1252
+#define CHARS_DIGITS_CP1252 "\xB2\xB3\xB9\xBC\xBD\xBE"
+#define CHARS_PUNCTUATION_CP1252 "\x82\x84\x85\x86\x87\x89\x8B\x91\x92\x93\x94\x95\x96\x97\x9B\xA1\xAB\xB7\xBB\xBF"
+#define CHARS_SPECIALS_CP1252 \
+	"\x80\x88\x98\x99\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAC\xAD\xAE\xAF\xB0\xB1\xB4\xB6\xB8\xD7\xF7"
+#define CHARS_ALPHA_CP1252 \
+	"\x83\x8A\x8C\x8E\x9A\x9C\x9E\x9F\xAA\xB5\xBA\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
+#define CHARS_WHITESPACE_CP1252 "\xA0"
+#define CHARS_CONTROL_CP1252
+#define CHARS_INVALID_CP1252 "\x81\x8D\x8F\x90\x9D"
+#define CHARS_VOWELS_CP1252 \
+	"\x59\x79\x8C\x9C\x9F\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFF"
+#define CHARS_CONSONANTS_CP1252 \
+	"\x83\x8A\x8E\x9A\x9E\x9F\xAA\xB5\xBA\xC7\xD0\xD1\xDD\xDE\xDF\xE7\xF0\xF1\xFD\xFE\xFF"
+
+// here is the CP1253 to Unicode conversion for CP1253 characters from 0x80 to 0xFF
+static UTF16 CP1253_to_unicode_high128[] = {
+0x20AC,0x0081,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021,0x0088,0x2030,0x008A,0x2039,0x008C,0x008D,0x008E,0x008F,
+0x0090,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,0x0098,0x2122,0x009A,0x203A,0x009C,0x009D,0x009E,0x009F,
+0x00A0,0x0385,0x0386,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x2015,
+0x00B0,0x00B1,0x00B2,0x00B3,0x0384,0x00B5,0x00B6,0x00B7,0x0388,0x0389,0x038A,0x00BB,0x038C,0x00BD,0x038E,0x038F,
+0x0390,0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,
+0x03A0,0x03A1,0x00D2,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,0x03A8,0x03A9,0x03AA,0x03AB,0x03AC,0x03AD,0x03AE,0x03AF,
+0x03B0,0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,0x03B8,0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,
+0x03C0,0x03C1,0x03C2,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,0x03C9,0x03CA,0x03CB,0x03CC,0x03CD,0x03CE,0x00FF };
+// *** WARNING, char at 0xC0 U+0390 (ΐ -> Ϊ́) needs to be looked into.  Single to multi-byte conversion
+// *** WARNING, char at 0xE0 U+03B0 (ΰ -> Ϋ́) needs to be looked into.  Single to multi-byte conversion
+
+// µάέήίαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ
+#define CHARS_LOWER_CP1253 \
+	"\xB5\xDC\xDD\xDE\xDF\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE"
+
+// ƒΐΰ
+#define CHARS_LOW_ONLY_CP1253 "\x83\xC0\xE0"
+
+// ΜΆΈΉΊΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΣΤΥΦΧΨΩΪΫΌΎΏ
+#define CHARS_UPPER_CP1253 \
+	"\xCC\xA2\xB8\xB9\xBA\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD3\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xBC\xBE\xBF"
+
+//
+#define CHARS_UP_ONLY_CP1253
+
+// ²³½
+#define CHARS_DIGITS_CP1253 "\xB2\xB3\xBD"
+
+// ‚„…†‡‰‹‘’“”•–—›«―·»
+#define CHARS_PUNCTUATION_CP1253 "\x82\x84\x85\x86\x87\x89\x8B\x91\x92\x93\x94\x95\x96\x97\x9B\xAB\xAF\xB7\xBB"
+
+// €™΅£¤¥¦§¨©¬­®°±΄¶
+#define CHARS_SPECIALS_CP1253 "\x80\x99\xA1\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAC\xAD\xAE\xB0\xB1\xB4\xB6"
+
+// ƒΆµΈΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ
+#define CHARS_ALPHA_CP1253 \
+	"\x83\xA2\xB5\xB8\xB9\xBA\xBC\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE"
+
+#define CHARS_WHITESPACE_CP1253 "\xA0"
+
+#define CHARS_CONTROL_CP1253
+
+#define CHARS_INVALID_CP1253 "\x81\x88\x8A\x8C\x8D\x8E\x8F\x90\x98\x9A\x9C\x9D\x9E\x9F\xAA\xD2\xFF"
+
+// YyΆΈΉΊΌΎΏΐΑΕΗΙΟΥΩΪΫάέήίΰαεηιουωϊϋόύώ
+#define CHARS_VOWELS_CP1253 \
+	"\x59\x79\xA2\xB8\xB9\xBA\xBC\xBE\xBF\xC0\xC1\xC5\xC7\xC9\xCF\xD5\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE5\xE7\xE9\xEF\xF5\xF9\xFA\xFB\xFC\xFD\xFE"
+
+// ƒµΒΓΔΖΘΚΛΜΝΞΠΡΣΤΦΧΨβγδζθκλμνξπρςστφχψ
+#define CHARS_CONSONANTS_CP1253 \
+	"\x83\xB5\xC2\xC3\xC4\xC6\xC8\xCA\xCB\xCC\xCD\xCE\xD0\xD1\xD3\xD4\xD6\xD7\xD8\xE2\xE3\xE4\xE6\xE8\xEA\xEB\xEC\xED\xEE\xF0\xF1\xF2\xF3\xF4\xF6\xF7\xF8"
 
 // ----8<------8<---- END OF AUTO-GENERATED DATA ----8<------8<----
 
diff --git a/src/options.c b/src/options.c
index dc421da..910b4db 100644
--- a/src/options.c
+++ b/src/options.c
@@ -268,6 +268,86 @@ void opt_init(char *name, int argc, char **argv)
 		return;
 	}
 
+	options.utf8 = options.iso8859_1 = options.iso8859_7 =
+	  options.iso8859_15 = options.koi8_r = options.cp437 =
+	  options.cp737 = options.cp850 = options.cp858 = options.cp866 =
+	  options.cp1251 = options.cp1252 = options.cp1253 = 0;
+	// by 'default' we are setup in 7 bit ascii mode (for rules).
+	options.ascii = 1;
+	options.encodingStr = "";
+	if ( (options.flags & FLG_INP_ENCODING) && options.encoding) {
+		// Ok, check a 'few' valid things for utf8
+		options.ascii = 0;
+		if (!strcasecmp(options.encoding, "utf8")||!strcasecmp(options.encoding, "utf-8")) {
+			options.utf8 = 1;
+			options.encodingStr = "UTF-8";
+		} else
+			if (!strcasecmp(options.encoding, "ansi")||!strcasecmp(options.encoding, "iso-8859-1")||!strcasecmp(options.encoding, "8859-1")||!strcasecmp(options.encoding, "iso8859-1")) {
+			options.iso8859_1 = 1;
+			options.encodingStr = "ISO-8859-1";
+		} else
+		if (!strcasecmp(options.encoding, "iso-8859-7")||!strcasecmp(options.encoding, "8859-7")||!strcasecmp(options.encoding, "iso8859-7")) {
+			options.iso8859_7 = 1;
+			options.encodingStr = "ISO-8859-7";
+		} else
+		if (!strcasecmp(options.encoding, "iso-8859-15")||!strcasecmp(options.encoding, "8859-15")||!strcasecmp(options.encoding, "iso8859-15")) {
+			options.iso8859_15 = 1;
+			options.encodingStr = "ISO-8859-15";
+		} else
+		if (!strcasecmp(options.encoding, "koi8-r")||!strcasecmp(options.encoding, "koi8r")) {
+			options.koi8_r = 1;
+			options.encodingStr = "KOI8-R";
+		} else
+		if (!strcasecmp(options.encoding, "cp437")||!strcasecmp(options.encoding, "cp-437")) {
+			options.cp437 = 1;
+			options.encodingStr = "CP437";
+		} else
+		if (!strcasecmp(options.encoding, "cp737")||!strcasecmp(options.encoding, "cp-737")) {
+			options.cp737 = 1;
+			options.encodingStr = "CP737";
+		} else
+		if (!strcasecmp(options.encoding, "cp850")||!strcasecmp(options.encoding, "cp-850")) {
+			options.cp850 = 1;
+			options.encodingStr = "CP850";
+		} else
+		if (!strcasecmp(options.encoding, "cp858")||!strcasecmp(options.encoding, "cp-858")) {
+			options.cp858 = 1;
+			options.encodingStr = "CP858";
+		} else
+		if (!strcasecmp(options.encoding, "cp866")||!strcasecmp(options.encoding, "cp-866")) {
+			options.cp866 = 1;
+			options.encodingStr = "CP866";
+		} else
+		if (!strcasecmp(options.encoding, "cp1251")||!strcasecmp(options.encoding, "cp-1251")) {
+			options.cp1251 = 1;
+			options.encodingStr = "CP1251";
+		} else
+		if (!strcasecmp(options.encoding, "cp1252")||!strcasecmp(options.encoding, "cp-1252")) {
+			options.cp1252 = 1;
+			options.encodingStr = "CP1252";
+		} else
+		if (!strcasecmp(options.encoding, "cp1253")||!strcasecmp(options.encoding, "cp-1253")) {
+			options.cp1253 = 1;
+			options.encodingStr = "CP1253";
+		} else
+		if (strcasecmp(options.encoding, "raw") && strcasecmp(options.encoding, "ascii") && strcasecmp(options.encoding, "default")) {
+			fprintf (stderr, "Supported encodings within john are: raw, utf-8, iso-8859-1 (or ansi)"
+					",\niso-8859-7"
+					", iso-8859-15"
+					", koi8-r"
+					", cp437"
+					", cp737"
+					", cp850"
+					", cp858"
+					", cp866"
+					",\ncp1251"
+					", cp1252"
+					", cp1253"
+					"\n");
+			error();
+		}
+	}
+
 	if (options.subformat && !strcasecmp(options.subformat, "list"))
 	{
 		md5_gen_DISPLAY_ALL_FORMATS();
@@ -462,73 +542,6 @@ void opt_init(char *name, int argc, char **argv)
 			fprintf (stderr, "using field sep char '%c' (0x%02x)\n", options.field_sep_char, options.field_sep_char);
 	}
 
-	options.utf8 = options.iso8859_1 = options.koi8_r = options.cp1251 = options.cp866 =
-	options.cp1252 = options.iso8859_15 = options.cp437 = options.cp850 = options.cp858 = options.cp737 = 0;
-	// by 'default' we are setup in 7 bit ascii mode (for rules).
-	options.ascii = 1;
-	options.encodingStr = "";
-	if ( (options.flags & FLG_INP_ENCODING) && options.encoding) {
-		// Ok, check a 'few' valid things for utf8
-		options.ascii = 0;
-		if (!strcasecmp(options.encoding, "utf8")||!strcasecmp(options.encoding, "utf-8")) {
-			options.utf8 = 1;
-			options.encodingStr = "UTF-8";
-		} else
-			if (!strcasecmp(options.encoding, "ansi")||!strcasecmp(options.encoding, "iso-8859-1")||!strcasecmp(options.encoding, "8859-1")||!strcasecmp(options.encoding, "iso8859-1")) {
-			options.iso8859_1 = 1;
-			options.encodingStr = "ISO-8859-1";
-		} else
-		if (!strcasecmp(options.encoding, "koi8-r")||!strcasecmp(options.encoding, "koi8r")) {
-			options.koi8_r = 1;
-			options.encodingStr = "KOI8-R";
-		} else
-		if (!strcasecmp(options.encoding, "cp1251")||!strcasecmp(options.encoding, "cp-1251")) {
-			options.cp1251 = 1;
-			options.encodingStr = "CP1251";
-		} else
-		if (!strcasecmp(options.encoding, "cp866")||!strcasecmp(options.encoding, "cp-866")) {
-			options.cp866 = 1;
-			options.encodingStr = "CP866";
-		} else
-		if (!strcasecmp(options.encoding, "cp1252")||!strcasecmp(options.encoding, "cp-1252")) {
-			options.cp1252 = 1;
-			options.encodingStr = "CP1252";
-		} else
-		if (!strcasecmp(options.encoding, "iso-8859-15")||!strcasecmp(options.encoding, "8859-15")||!strcasecmp(options.encoding, "iso8859-15")) {
-			options.iso8859_15 = 1;
-			options.encodingStr = "ISO-8859-15";
-		} else
-		if (!strcasecmp(options.encoding, "cp437")||!strcasecmp(options.encoding, "cp-437")) {
-			options.cp437 = 1;
-			options.encodingStr = "CP437";
-		} else
-		if (!strcasecmp(options.encoding, "cp850")||!strcasecmp(options.encoding, "cp-850")) {
-			options.cp850 = 1;
-			options.encodingStr = "CP850";
-		} else
-		if (!strcasecmp(options.encoding, "cp858")||!strcasecmp(options.encoding, "cp-858")) {
-			options.cp858 = 1;
-			options.encodingStr = "CP858";
-		} else
-		if (!strcasecmp(options.encoding, "cp737")||!strcasecmp(options.encoding, "cp-737")) {
-			options.cp737 = 1;
-			options.encodingStr = "CP737";
-		} else {
-			fprintf (stderr, "Supported encodings within john are: raw, utf-8, iso-8859-1 (or ansi)"
-					", koi8-r"
-					", cp1251"
-					", cp866"
-					", cp1252"
-					", iso-8859-15"
-					", cp437"
-					", cp850"
-					", cp858"
-					", cp737"
-					"\n");
-			error();
-		}
-	}
-
 	rec_argc = argc; rec_argv = argv;
 	rec_check = 0;
 }
diff --git a/src/options.h b/src/options.h
index 9df19a9..37e7743 100644
--- a/src/options.h
+++ b/src/options.h
@@ -160,15 +160,17 @@ struct options_main {
 	int ascii;  // if NO other charset is used, we set this to 1.  This tells us to user 7 bit ASCII.
 	int utf8;
 	int iso8859_1;
-	int koi8_r;
-	int cp1251;
-	int cp866;
-	int cp1252;
+	int iso8859_7;
 	int iso8859_15;
+	int koi8_r;
 	int cp437;
+	int cp737;
 	int cp850;
 	int cp858;
-	int cp737;
+	int cp866;
+	int cp1251;
+	int cp1252;
+	int cp1253;
 
 /* Show/log/store UTF-8 regardless of input decoding */
 	int store_utf8;
diff --git a/src/rules.c b/src/rules.c
index d3cd1f1..12b181b 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -131,10 +131,10 @@ static struct {
 #include "encoding_data.h"
 
 // this will 'pacify' compiler warnings.
-UTF16 *JunkStuff[] = {KOI8_R_to_unicode_high128, CP1251_to_unicode_high128, CP866_to_unicode_high128,
-                      CP1252_to_unicode_high128, ISO_8859_15_to_unicode_high128, CP437_to_unicode_high128,
-                      CP850_to_unicode_high128, CP858_to_unicode_high128, CP737_to_unicode_high128,
-                      ISO_8859_1_to_unicode_high128};
+UTF16 *JunkStuff[] = {ISO_8859_1_to_unicode_high128, ISO_8859_7_to_unicode_high128, ISO_8859_15_to_unicode_high128,
+		      KOI8_R_to_unicode_high128, CP437_to_unicode_high128, CP737_to_unicode_high128,
+		      CP850_to_unicode_high128, CP858_to_unicode_high128, CP866_to_unicode_high128,
+		      CP1251_to_unicode_high128, CP1252_to_unicode_high128, CP1253_to_unicode_high128};
 
 static char *conv_source = CONV_SOURCE;
 static char *conv_shift, *conv_invert, *conv_vowels, *conv_right, *conv_left;
@@ -333,58 +333,19 @@ static void rules_init_classes(void)
 		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_ISO_8859_1 CHARS_DIGITS CHARS_DIGITS_ISO_8859_1);
 		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_ISO_8859_1);
 		rules_init_class('Y', CHARS_INVALID_ISO_8859_1);
-	} else if (options.koi8_r) {
-		rules_init_class('v', CHARS_VOWELS CHARS_VOWELS_KOI8_R);
-		rules_init_class('c', CHARS_CONSONANTS CHARS_CONSONANTS_KOI8_R);
-		rules_init_class('w', CHARS_WHITESPACE CHARS_WHITESPACE_KOI8_R);
-		rules_init_class('p', CHARS_PUNCTUATION CHARS_PUNCTUATION_KOI8_R);
-		rules_init_class('s', CHARS_SPECIALS CHARS_SPECIALS_KOI8_R);
-		rules_init_class('l', CHARS_LOWER CHARS_LOWER_KOI8_R CHARS_LOW_ONLY_KOI8_R);
-		rules_init_class('u', CHARS_UPPER CHARS_UPPER_KOI8_R CHARS_UP_ONLY_KOI8_R);
-		rules_init_class('d', CHARS_DIGITS CHARS_DIGITS_KOI8_R);
-		rules_init_class('a', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_KOI8_R);
-		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_KOI8_R CHARS_DIGITS CHARS_DIGITS_KOI8_R);
-		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_KOI8_R);
-		rules_init_class('Y', CHARS_INVALID_KOI8_R);
-	} else if (options.cp1251) {
-		rules_init_class('v', CHARS_VOWELS CHARS_VOWELS_CP1251);
-		rules_init_class('c', CHARS_CONSONANTS CHARS_CONSONANTS_CP1251);
-		rules_init_class('w', CHARS_WHITESPACE CHARS_WHITESPACE_CP1251);
-		rules_init_class('p', CHARS_PUNCTUATION CHARS_PUNCTUATION_CP1251);
-		rules_init_class('s', CHARS_SPECIALS CHARS_SPECIALS_CP1251);
-		rules_init_class('l', CHARS_LOWER CHARS_LOWER_CP1251 CHARS_LOW_ONLY_CP1251);
-		rules_init_class('u', CHARS_UPPER CHARS_UPPER_CP1251 CHARS_UP_ONLY_CP1251);
-		rules_init_class('d', CHARS_DIGITS CHARS_DIGITS_CP1251);
-		rules_init_class('a', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP1251);
-		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP1251 CHARS_DIGITS  CHARS_DIGITS_CP1251);
-		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_CP1251);
-		rules_init_class('Y', CHARS_INVALID_CP1251);
-	} else if (options.cp866) {
-		rules_init_class('v', CHARS_VOWELS CHARS_VOWELS_CP866);
-		rules_init_class('c', CHARS_CONSONANTS CHARS_CONSONANTS_CP866);
-		rules_init_class('w', CHARS_WHITESPACE CHARS_WHITESPACE_CP866);
-		rules_init_class('p', CHARS_PUNCTUATION CHARS_PUNCTUATION_CP866);
-		rules_init_class('s', CHARS_SPECIALS CHARS_SPECIALS_CP866);
-		rules_init_class('l', CHARS_LOWER CHARS_LOWER_CP866 CHARS_LOW_ONLY_CP866);
-		rules_init_class('u', CHARS_UPPER CHARS_UPPER_CP866 CHARS_UP_ONLY_CP866);
-		rules_init_class('d', CHARS_DIGITS CHARS_DIGITS_CP866);
-		rules_init_class('a', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP866);
-		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP866 CHARS_DIGITS  CHARS_DIGITS_CP866);
-		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_CP866);
-		rules_init_class('Y', CHARS_INVALID_CP866);
-	} else if (options.cp1252) {
-		rules_init_class('v', CHARS_VOWELS CHARS_VOWELS_CP1252);
-		rules_init_class('c', CHARS_CONSONANTS CHARS_CONSONANTS_CP1252);
-		rules_init_class('w', CHARS_WHITESPACE CHARS_WHITESPACE_CP1252);
-		rules_init_class('p', CHARS_PUNCTUATION CHARS_PUNCTUATION_CP1252);
-		rules_init_class('s', CHARS_SPECIALS CHARS_SPECIALS_CP1252);
-		rules_init_class('l', CHARS_LOWER CHARS_LOWER_CP1252 CHARS_LOW_ONLY_CP1252);
-		rules_init_class('u', CHARS_UPPER CHARS_UPPER_CP1252 CHARS_UP_ONLY_CP1252);
-		rules_init_class('d', CHARS_DIGITS CHARS_DIGITS_CP1252);
-		rules_init_class('a', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP1252);
-		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP1252 CHARS_DIGITS  CHARS_DIGITS_CP1252);
-		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_CP1252);
-		rules_init_class('Y', CHARS_INVALID_CP1252);
+	} else if (options.iso8859_7) {
+		rules_init_class('v', CHARS_VOWELS CHARS_VOWELS_ISO_8859_7);
+		rules_init_class('c', CHARS_CONSONANTS CHARS_CONSONANTS_ISO_8859_7);
+		rules_init_class('w', CHARS_WHITESPACE CHARS_WHITESPACE_ISO_8859_7);
+		rules_init_class('p', CHARS_PUNCTUATION CHARS_PUNCTUATION_ISO_8859_7);
+		rules_init_class('s', CHARS_SPECIALS CHARS_SPECIALS_ISO_8859_7);
+		rules_init_class('l', CHARS_LOWER CHARS_LOWER_ISO_8859_7 CHARS_LOW_ONLY_ISO_8859_7);
+		rules_init_class('u', CHARS_UPPER CHARS_UPPER_ISO_8859_7 CHARS_UP_ONLY_ISO_8859_7);
+		rules_init_class('d', CHARS_DIGITS CHARS_DIGITS_ISO_8859_7);
+		rules_init_class('a', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_ISO_8859_7);
+		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_ISO_8859_7 CHARS_DIGITS  CHARS_DIGITS_ISO_8859_7);
+		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_ISO_8859_7);
+		rules_init_class('Y', CHARS_INVALID_ISO_8859_7);
 	} else if (options.iso8859_15) {
 		rules_init_class('v', CHARS_VOWELS CHARS_VOWELS_ISO_8859_15);
 		rules_init_class('c', CHARS_CONSONANTS CHARS_CONSONANTS_ISO_8859_15);
@@ -398,6 +359,19 @@ static void rules_init_classes(void)
 		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_ISO_8859_15 CHARS_DIGITS  CHARS_DIGITS_ISO_8859_15);
 		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_ISO_8859_15);
 		rules_init_class('Y', CHARS_INVALID_ISO_8859_15);
+	} else if (options.koi8_r) {
+		rules_init_class('v', CHARS_VOWELS CHARS_VOWELS_KOI8_R);
+		rules_init_class('c', CHARS_CONSONANTS CHARS_CONSONANTS_KOI8_R);
+		rules_init_class('w', CHARS_WHITESPACE CHARS_WHITESPACE_KOI8_R);
+		rules_init_class('p', CHARS_PUNCTUATION CHARS_PUNCTUATION_KOI8_R);
+		rules_init_class('s', CHARS_SPECIALS CHARS_SPECIALS_KOI8_R);
+		rules_init_class('l', CHARS_LOWER CHARS_LOWER_KOI8_R CHARS_LOW_ONLY_KOI8_R);
+		rules_init_class('u', CHARS_UPPER CHARS_UPPER_KOI8_R CHARS_UP_ONLY_KOI8_R);
+		rules_init_class('d', CHARS_DIGITS CHARS_DIGITS_KOI8_R);
+		rules_init_class('a', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_KOI8_R);
+		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_KOI8_R CHARS_DIGITS CHARS_DIGITS_KOI8_R);
+		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_KOI8_R);
+		rules_init_class('Y', CHARS_INVALID_KOI8_R);
 	} else if (options.cp437) {
 		rules_init_class('v', CHARS_VOWELS CHARS_VOWELS_CP437);
 		rules_init_class('c', CHARS_CONSONANTS CHARS_CONSONANTS_CP437);
@@ -411,6 +385,19 @@ static void rules_init_classes(void)
 		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP437 CHARS_DIGITS  CHARS_DIGITS_CP437);
 		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_CP437);
 		rules_init_class('Y', CHARS_INVALID_CP437);
+	} else if (options.cp737) {
+		rules_init_class('v', CHARS_VOWELS CHARS_VOWELS_CP737);
+		rules_init_class('c', CHARS_CONSONANTS CHARS_CONSONANTS_CP737);
+		rules_init_class('w', CHARS_WHITESPACE CHARS_WHITESPACE_CP737);
+		rules_init_class('p', CHARS_PUNCTUATION CHARS_PUNCTUATION_CP737);
+		rules_init_class('s', CHARS_SPECIALS CHARS_SPECIALS_CP737);
+		rules_init_class('l', CHARS_LOWER CHARS_LOWER_CP737 CHARS_LOW_ONLY_CP737);
+		rules_init_class('u', CHARS_UPPER CHARS_UPPER_CP737 CHARS_UP_ONLY_CP737);
+		rules_init_class('d', CHARS_DIGITS CHARS_DIGITS_CP737);
+		rules_init_class('a', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP737);
+		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP737 CHARS_DIGITS  CHARS_DIGITS_CP737);
+		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_CP737);
+		rules_init_class('Y', CHARS_INVALID_CP737);
 	} else if (options.cp850) {
 		// NOTE, we need to deal with U+0131 (dottless I)
 		rules_init_class('v', CHARS_VOWELS CHARS_VOWELS_CP850);
@@ -438,19 +425,58 @@ static void rules_init_classes(void)
 		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP858 CHARS_DIGITS  CHARS_DIGITS_CP858);
 		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_CP858);
 		rules_init_class('Y', CHARS_INVALID_CP858);
-	} else if (options.cp737) {
-		rules_init_class('v', CHARS_VOWELS CHARS_VOWELS_CP737);
-		rules_init_class('c', CHARS_CONSONANTS CHARS_CONSONANTS_CP737);
-		rules_init_class('w', CHARS_WHITESPACE CHARS_WHITESPACE_CP737);
-		rules_init_class('p', CHARS_PUNCTUATION CHARS_PUNCTUATION_CP737);
-		rules_init_class('s', CHARS_SPECIALS CHARS_SPECIALS_CP737);
-		rules_init_class('l', CHARS_LOWER CHARS_LOWER_CP737 CHARS_LOW_ONLY_CP737);
-		rules_init_class('u', CHARS_UPPER CHARS_UPPER_CP737 CHARS_UP_ONLY_CP737);
-		rules_init_class('d', CHARS_DIGITS CHARS_DIGITS_CP737);
-		rules_init_class('a', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP737);
-		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP737 CHARS_DIGITS  CHARS_DIGITS_CP737);
-		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_CP737);
-		rules_init_class('Y', CHARS_INVALID_CP737);
+	} else if (options.cp866) {
+		rules_init_class('v', CHARS_VOWELS CHARS_VOWELS_CP866);
+		rules_init_class('c', CHARS_CONSONANTS CHARS_CONSONANTS_CP866);
+		rules_init_class('w', CHARS_WHITESPACE CHARS_WHITESPACE_CP866);
+		rules_init_class('p', CHARS_PUNCTUATION CHARS_PUNCTUATION_CP866);
+		rules_init_class('s', CHARS_SPECIALS CHARS_SPECIALS_CP866);
+		rules_init_class('l', CHARS_LOWER CHARS_LOWER_CP866 CHARS_LOW_ONLY_CP866);
+		rules_init_class('u', CHARS_UPPER CHARS_UPPER_CP866 CHARS_UP_ONLY_CP866);
+		rules_init_class('d', CHARS_DIGITS CHARS_DIGITS_CP866);
+		rules_init_class('a', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP866);
+		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP866 CHARS_DIGITS  CHARS_DIGITS_CP866);
+		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_CP866);
+		rules_init_class('Y', CHARS_INVALID_CP866);
+	} else if (options.cp1251) {
+		rules_init_class('v', CHARS_VOWELS CHARS_VOWELS_CP1251);
+		rules_init_class('c', CHARS_CONSONANTS CHARS_CONSONANTS_CP1251);
+		rules_init_class('w', CHARS_WHITESPACE CHARS_WHITESPACE_CP1251);
+		rules_init_class('p', CHARS_PUNCTUATION CHARS_PUNCTUATION_CP1251);
+		rules_init_class('s', CHARS_SPECIALS CHARS_SPECIALS_CP1251);
+		rules_init_class('l', CHARS_LOWER CHARS_LOWER_CP1251 CHARS_LOW_ONLY_CP1251);
+		rules_init_class('u', CHARS_UPPER CHARS_UPPER_CP1251 CHARS_UP_ONLY_CP1251);
+		rules_init_class('d', CHARS_DIGITS CHARS_DIGITS_CP1251);
+		rules_init_class('a', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP1251);
+		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP1251 CHARS_DIGITS  CHARS_DIGITS_CP1251);
+		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_CP1251);
+		rules_init_class('Y', CHARS_INVALID_CP1251);
+	} else if (options.cp1252) {
+		rules_init_class('v', CHARS_VOWELS CHARS_VOWELS_CP1252);
+		rules_init_class('c', CHARS_CONSONANTS CHARS_CONSONANTS_CP1252);
+		rules_init_class('w', CHARS_WHITESPACE CHARS_WHITESPACE_CP1252);
+		rules_init_class('p', CHARS_PUNCTUATION CHARS_PUNCTUATION_CP1252);
+		rules_init_class('s', CHARS_SPECIALS CHARS_SPECIALS_CP1252);
+		rules_init_class('l', CHARS_LOWER CHARS_LOWER_CP1252 CHARS_LOW_ONLY_CP1252);
+		rules_init_class('u', CHARS_UPPER CHARS_UPPER_CP1252 CHARS_UP_ONLY_CP1252);
+		rules_init_class('d', CHARS_DIGITS CHARS_DIGITS_CP1252);
+		rules_init_class('a', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP1252);
+		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP1252 CHARS_DIGITS  CHARS_DIGITS_CP1252);
+		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_CP1252);
+		rules_init_class('Y', CHARS_INVALID_CP1252);
+	} else if (options.cp1253) {
+		rules_init_class('v', CHARS_VOWELS CHARS_VOWELS_CP1253);
+		rules_init_class('c', CHARS_CONSONANTS CHARS_CONSONANTS_CP1253);
+		rules_init_class('w', CHARS_WHITESPACE CHARS_WHITESPACE_CP1253);
+		rules_init_class('p', CHARS_PUNCTUATION CHARS_PUNCTUATION_CP1253);
+		rules_init_class('s', CHARS_SPECIALS CHARS_SPECIALS_CP1253);
+		rules_init_class('l', CHARS_LOWER CHARS_LOWER_CP1253 CHARS_LOW_ONLY_CP1253);
+		rules_init_class('u', CHARS_UPPER CHARS_UPPER_CP1253 CHARS_UP_ONLY_CP1253);
+		rules_init_class('d', CHARS_DIGITS CHARS_DIGITS_CP1253);
+		rules_init_class('a', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP1253);
+		rules_init_class('x', CHARS_LOWER CHARS_UPPER CHARS_ALPHA_CP1253 CHARS_DIGITS  CHARS_DIGITS_CP1253);
+		rules_init_class('o', CHARS_CONTROL_ASCII CHARS_CONTROL_CP1253);
+		rules_init_class('Y', CHARS_INVALID_CP1253);
 	} else {
 		rules_init_class('v', CHARS_VOWELS);
 		rules_init_class('c', CHARS_CONSONANTS);
@@ -498,42 +524,38 @@ static void rules_init_convs(void)
 		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_ISO_8859_1 CHARS_LOWER_ISO_8859_1);
 		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_ISO_8859_1, CHARS_LOWER CHARS_LOWER_ISO_8859_1);
 		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_ISO_8859_1, CHARS_UPPER CHARS_UPPER_ISO_8859_1);
-	} else if (options.koi8_r) {
-		conv_source = CONV_SOURCE CHARS_LOWER_KOI8_R CHARS_UPPER_KOI8_R;
-		conv_shift = rules_init_conv(conv_source, CONV_SHIFT CHARS_UPPER_KOI8_R CHARS_LOWER_KOI8_R);
-		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_KOI8_R CHARS_LOWER_KOI8_R);
-		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_KOI8_R, CHARS_LOWER CHARS_LOWER_KOI8_R);
-		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_KOI8_R, CHARS_UPPER CHARS_UPPER_KOI8_R);
-	} else if (options.cp1251) {
-		conv_source = CONV_SOURCE CHARS_LOWER_CP1251 CHARS_UPPER_CP1251;
-		conv_shift = rules_init_conv(conv_source, CONV_SHIFT CHARS_UPPER_CP1251 CHARS_LOWER_CP1251);
-		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_CP1251 CHARS_LOWER_CP1251);
-		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_CP1251, CHARS_LOWER CHARS_LOWER_CP1251);
-		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_CP1251, CHARS_UPPER CHARS_UPPER_CP1251);
-	} else if (options.cp866) {
-		conv_source = CONV_SOURCE CHARS_LOWER_CP866 CHARS_UPPER_CP866;
-		conv_shift = rules_init_conv(conv_source, CONV_SHIFT CHARS_UPPER_CP866 CHARS_LOWER_CP866);
-		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_CP866 CHARS_LOWER_CP866);
-		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_CP866, CHARS_LOWER CHARS_LOWER_CP866);
-		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_CP866, CHARS_UPPER CHARS_UPPER_CP866);
-	} else if (options.cp1252) {
-		conv_source = CONV_SOURCE CHARS_LOWER_CP1252 CHARS_UPPER_CP1252;
-		conv_shift = rules_init_conv(conv_source, CONV_SHIFT CHARS_UPPER_CP1252 CHARS_LOWER_CP1252);
-		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_CP1252 CHARS_LOWER_CP1252);
-		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_CP1252, CHARS_LOWER CHARS_LOWER_CP1252);
-		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_CP1252, CHARS_UPPER CHARS_UPPER_CP1252);
+	} else if (options.iso8859_7) {
+		conv_source = CONV_SOURCE CHARS_LOWER_ISO_8859_7 CHARS_UPPER_ISO_8859_7;
+		conv_shift = rules_init_conv(conv_source, CONV_SHIFT CHARS_UPPER_ISO_8859_7 CHARS_LOWER_ISO_8859_7);
+		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_ISO_8859_7 CHARS_LOWER_ISO_8859_7);
+		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_ISO_8859_7, CHARS_LOWER CHARS_LOWER_ISO_8859_7);
+		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_ISO_8859_7, CHARS_UPPER CHARS_UPPER_ISO_8859_7);
+		// *** WARNING, char at 0xC0 U+0390 (ΐ -> Ϊ́) needs to be looked into.  Single to multi-byte conversion
+		// *** WARNING, char at 0xE0 U+03B0 (ΰ -> Ϋ́) needs to be looked into.  Single to multi-byte conversion
 	} else if (options.iso8859_15) {
 		conv_source = CONV_SOURCE CHARS_LOWER_ISO_8859_15 CHARS_UPPER_ISO_8859_15;
 		conv_shift = rules_init_conv(conv_source, CONV_SHIFT CHARS_UPPER_ISO_8859_15 CHARS_LOWER_ISO_8859_15);
 		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_ISO_8859_15 CHARS_LOWER_ISO_8859_15);
 		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_ISO_8859_15, CHARS_LOWER CHARS_LOWER_ISO_8859_15);
 		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_ISO_8859_15, CHARS_UPPER CHARS_UPPER_ISO_8859_15);
+	} else if (options.koi8_r) {
+		conv_source = CONV_SOURCE CHARS_LOWER_KOI8_R CHARS_UPPER_KOI8_R;
+		conv_shift = rules_init_conv(conv_source, CONV_SHIFT CHARS_UPPER_KOI8_R CHARS_LOWER_KOI8_R);
+		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_KOI8_R CHARS_LOWER_KOI8_R);
+		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_KOI8_R, CHARS_LOWER CHARS_LOWER_KOI8_R);
+		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_KOI8_R, CHARS_UPPER CHARS_UPPER_KOI8_R);
 	} else if (options.cp437) {
 		conv_source = CONV_SOURCE CHARS_LOWER_CP437 CHARS_UPPER_CP437;
 		conv_shift = rules_init_conv(conv_source, CONV_SHIFT CHARS_UPPER_CP437 CHARS_LOWER_CP437);
 		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_CP437 CHARS_LOWER_CP437);
 		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_CP437, CHARS_LOWER CHARS_LOWER_CP437);
 		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_CP437, CHARS_UPPER CHARS_UPPER_CP437);
+	} else if (options.cp737) {
+		conv_source = CONV_SOURCE CHARS_LOWER_CP737 CHARS_UPPER_CP737;
+		conv_shift = rules_init_conv(conv_source, CONV_SHIFT CHARS_UPPER_CP737 CHARS_LOWER_CP737);
+		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_CP737 CHARS_LOWER_CP737);
+		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_CP737, CHARS_LOWER CHARS_LOWER_CP737);
+		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_CP737, CHARS_UPPER CHARS_UPPER_CP737);
 	} else if (options.cp850) {
 		conv_source = CONV_SOURCE CHARS_LOWER_CP850 CHARS_UPPER_CP850;
 		conv_shift = rules_init_conv(conv_source, CONV_SHIFT CHARS_UPPER_CP850 CHARS_LOWER_CP850);
@@ -549,12 +571,32 @@ static void rules_init_convs(void)
 		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_CP858 CHARS_LOWER_CP858);
 		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_CP858, CHARS_LOWER CHARS_LOWER_CP858);
 		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_CP858, CHARS_UPPER CHARS_UPPER_CP858);
-	} else if (options.cp737) {
-		conv_source = CONV_SOURCE CHARS_LOWER_CP737 CHARS_UPPER_CP737;
-		conv_shift = rules_init_conv(conv_source, CONV_SHIFT CHARS_UPPER_CP737 CHARS_LOWER_CP737);
-		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_CP737 CHARS_LOWER_CP737);
-		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_CP737, CHARS_LOWER CHARS_LOWER_CP737);
-		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_CP737, CHARS_UPPER CHARS_UPPER_CP737);
+	} else if (options.cp866) {
+		conv_source = CONV_SOURCE CHARS_LOWER_CP866 CHARS_UPPER_CP866;
+		conv_shift = rules_init_conv(conv_source, CONV_SHIFT CHARS_UPPER_CP866 CHARS_LOWER_CP866);
+		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_CP866 CHARS_LOWER_CP866);
+		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_CP866, CHARS_LOWER CHARS_LOWER_CP866);
+		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_CP866, CHARS_UPPER CHARS_UPPER_CP866);
+	} else if (options.cp1251) {
+		conv_source = CONV_SOURCE CHARS_LOWER_CP1251 CHARS_UPPER_CP1251;
+		conv_shift = rules_init_conv(conv_source, CONV_SHIFT CHARS_UPPER_CP1251 CHARS_LOWER_CP1251);
+		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_CP1251 CHARS_LOWER_CP1251);
+		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_CP1251, CHARS_LOWER CHARS_LOWER_CP1251);
+		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_CP1251, CHARS_UPPER CHARS_UPPER_CP1251);
+	} else if (options.cp1252) {
+		conv_source = CONV_SOURCE CHARS_LOWER_CP1252 CHARS_UPPER_CP1252;
+		conv_shift = rules_init_conv(conv_source, CONV_SHIFT CHARS_UPPER_CP1252 CHARS_LOWER_CP1252);
+		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_CP1252 CHARS_LOWER_CP1252);
+		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_CP1252, CHARS_LOWER CHARS_LOWER_CP1252);
+		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_CP1252, CHARS_UPPER CHARS_UPPER_CP1252);
+	} else if (options.cp1253) {
+		conv_source = CONV_SOURCE CHARS_LOWER_CP1253 CHARS_UPPER_CP1253;
+		conv_shift = rules_init_conv(conv_source, CONV_SHIFT CHARS_UPPER_CP1253 CHARS_LOWER_CP1253);
+		conv_invert = rules_init_conv(conv_source, CONV_INVERT CHARS_UPPER_CP1253 CHARS_LOWER_CP1253);
+		conv_tolower = rules_init_conv(CHARS_UPPER CHARS_UPPER_CP1253, CHARS_LOWER CHARS_LOWER_CP1253);
+		conv_toupper = rules_init_conv(CHARS_LOWER CHARS_LOWER_CP1253, CHARS_UPPER CHARS_UPPER_CP1253);
+		// *** WARNING, char at 0xC0 U+0390 (ΐ -> Ϊ́) needs to be looked into.  Single to multi-byte conversion
+		// *** WARNING, char at 0xE0 U+03B0 (ΰ -> Ϋ́) needs to be looked into.  Single to multi-byte conversion
 	} else {
 		conv_shift = rules_init_conv(conv_source, CONV_SHIFT);
 		conv_invert = rules_init_conv(conv_source, CONV_INVERT);
diff --git a/src/unicode.c b/src/unicode.c
index 8f723b0..1f5d20f 100644
--- a/src/unicode.c
+++ b/src/unicode.c
@@ -770,48 +770,56 @@ int initUnicode(int type) {
 		CP_to_Unicode[i] = i;
 	}
 	for (i = 128; i < 256; ++i) {
-		if (options.cp1251)
-			CP_to_Unicode[i] = CP1251_to_unicode_high128[i-128];
-		else if (options.koi8_r)
-			CP_to_Unicode[i] = KOI8_R_to_unicode_high128[i-128];
-		else if (options.cp866)
-			CP_to_Unicode[i] = CP866_to_unicode_high128[i-128];
-		else if (options.cp1252)
-			CP_to_Unicode[i] = CP1252_to_unicode_high128[i-128];
+		if (options.iso8859_7)
+			CP_to_Unicode[i] = ISO_8859_7_to_unicode_high128[i-128];
 		else if (options.iso8859_15)
 			CP_to_Unicode[i] = ISO_8859_15_to_unicode_high128[i-128];
+		else if (options.koi8_r)
+			CP_to_Unicode[i] = KOI8_R_to_unicode_high128[i-128];
 		else if (options.cp437)
 			CP_to_Unicode[i] = CP437_to_unicode_high128[i-128];
+		else if (options.cp737)
+			CP_to_Unicode[i] = CP737_to_unicode_high128[i-128];
 		else if (options.cp850)
 			CP_to_Unicode[i] = CP850_to_unicode_high128[i-128];
 		else if (options.cp858)
 			CP_to_Unicode[i] = CP858_to_unicode_high128[i-128];
-		else if (options.cp737)
-			CP_to_Unicode[i] = CP737_to_unicode_high128[i-128];
+		else if (options.cp866)
+			CP_to_Unicode[i] = CP866_to_unicode_high128[i-128];
+		else if (options.cp1251)
+			CP_to_Unicode[i] = CP1251_to_unicode_high128[i-128];
+		else if (options.cp1252)
+			CP_to_Unicode[i] = CP1252_to_unicode_high128[i-128];
+		else if (options.cp1253)
+			CP_to_Unicode[i] = CP1253_to_unicode_high128[i-128];
 		else
 			CP_to_Unicode[i] = ISO_8859_1_to_unicode_high128[i-128]; // 8859-1
 	}
 	for (i = 0; i < 0x10000; ++i)
 		CP_from_Unicode[i] = i;  // will truncate to lower 8 bits.
 	for (i = 0; i < 128; ++i) {
-		if (options.cp1251)
-			CP_from_Unicode[CP1251_to_unicode_high128[i]] = i+128;
-		else if (options.koi8_r)
-			CP_from_Unicode[KOI8_R_to_unicode_high128[i]] = i+128;
-		else if (options.cp866)
-			CP_from_Unicode[CP866_to_unicode_high128[i]] = i+128;
-		else if (options.cp1252)
-			CP_from_Unicode[CP1252_to_unicode_high128[i]] = i+128;
+		if (options.iso8859_7)
+			CP_from_Unicode[ISO_8859_7_to_unicode_high128[i]] = i+128;
 		else if (options.iso8859_15)
 			CP_from_Unicode[ISO_8859_15_to_unicode_high128[i]] = i+128;
+		else if (options.koi8_r)
+			CP_from_Unicode[KOI8_R_to_unicode_high128[i]] = i+128;
 		else if (options.cp437)
 			CP_from_Unicode[CP437_to_unicode_high128[i]] = i+128;
+		else if (options.cp737)
+			CP_from_Unicode[CP737_to_unicode_high128[i]] = i+128;
 		else if (options.cp850)
 			CP_from_Unicode[CP850_to_unicode_high128[i]] = i+128;
 		else if (options.cp858)
 			CP_from_Unicode[CP858_to_unicode_high128[i]] = i+128;
-		else if (options.cp737)
-			CP_from_Unicode[CP737_to_unicode_high128[i]] = i+128;
+		else if (options.cp866)
+			CP_from_Unicode[CP866_to_unicode_high128[i]] = i+128;
+		else if (options.cp1251)
+			CP_from_Unicode[CP1251_to_unicode_high128[i]] = i+128;
+		else if (options.cp1252)
+			CP_from_Unicode[CP1252_to_unicode_high128[i]] = i+128;
+		else if (options.cp1253)
+			CP_from_Unicode[CP1253_to_unicode_high128[i]] = i+128;
 		else {
 			CP_from_Unicode[ISO_8859_1_to_unicode_high128[i]] = i+128;
 			if (!i)
@@ -828,27 +836,31 @@ int initUnicode(int type) {
 	for (i = 'A'; i <= 'Z'; ++i)
 		CP_down[i] = (i^0x20);
 
-	// now handle upper 128 byte values for casing.
-	if (options.koi8_r) {
-		cpU = (unsigned char*)CHARS_UPPER_KOI8_R; cpL = (unsigned char*)CHARS_LOWER_KOI8_R;
-	} else if (options.cp1251) {
-		cpU = (unsigned char*)CHARS_UPPER_CP1251; cpL = (unsigned char*)CHARS_LOWER_CP1251; // CHARS_LOW_ONLY_CP1251 is not needed.
-	} else if (options.cp866) {
-		cpU = (unsigned char*)CHARS_UPPER_CP866; cpL = (unsigned char*)CHARS_LOWER_CP866;
-	} else if (options.cp1252) {
-		cpU = (unsigned char*)CHARS_UPPER_CP1252; cpL = (unsigned char*)CHARS_LOWER_CP1252;
+	// now handle upper 128 byte values for casing.  CHARS_LOW_ONLY_xxxx is not needed.
+	if (options.iso8859_1) {
+		cpU = (unsigned char*)CHARS_UPPER_ISO_8859_1; cpL = (unsigned char*)CHARS_LOWER_ISO_8859_1;
+	} else if (options.iso8859_7) {
+		cpU = (unsigned char*)CHARS_UPPER_ISO_8859_7; cpL = (unsigned char*)CHARS_LOWER_ISO_8859_7;
 	} else if (options.iso8859_15) {
 		cpU = (unsigned char*)CHARS_UPPER_ISO_8859_15; cpL = (unsigned char*)CHARS_LOWER_ISO_8859_15;
+	} else if (options.koi8_r) {
+		cpU = (unsigned char*)CHARS_UPPER_KOI8_R; cpL = (unsigned char*)CHARS_LOWER_KOI8_R;
 	} else if (options.cp437) {
 		cpU = (unsigned char*)CHARS_UPPER_CP437; cpL = (unsigned char*)CHARS_LOWER_CP437;
+	} else if (options.cp737) {
+		cpU = (unsigned char*)CHARS_UPPER_CP737; cpL = (unsigned char*)CHARS_LOWER_CP737;
 	} else if (options.cp850) {
 		cpU = (unsigned char*)CHARS_UPPER_CP850; cpL = (unsigned char*)CHARS_LOWER_CP850;
 	} else if (options.cp858) {
 		cpU = (unsigned char*)CHARS_UPPER_CP858; cpL = (unsigned char*)CHARS_LOWER_CP858;
-	} else if (options.cp737) {
-		cpU = (unsigned char*)CHARS_UPPER_CP737; cpL = (unsigned char*)CHARS_LOWER_CP737;
-	} else if (options.iso8859_1) {
-		cpU = (unsigned char*)CHARS_UPPER_ISO_8859_1; cpL = (unsigned char*)CHARS_LOWER_ISO_8859_1;  // CHARS_LOW_ONLY_ISO_8859_1 is not needed.
+	} else if (options.cp866) {
+		cpU = (unsigned char*)CHARS_UPPER_CP866; cpL = (unsigned char*)CHARS_LOWER_CP866;
+	} else if (options.cp1251) {
+		cpU = (unsigned char*)CHARS_UPPER_CP1251; cpL = (unsigned char*)CHARS_LOWER_CP1251;
+	} else if (options.cp1252) {
+		cpU = (unsigned char*)CHARS_UPPER_CP1252; cpL = (unsigned char*)CHARS_LOWER_CP1252;
+	} else if (options.cp1253) {
+		cpU = (unsigned char*)CHARS_UPPER_CP1253; cpL = (unsigned char*)CHARS_LOWER_CP1253;
 	} else {  // old-style ASCII-only
 		cpU = (unsigned char*)""; cpL = (unsigned char*)"";
 	}
@@ -878,26 +890,30 @@ int initUnicode(int type) {
 #define CP_issep \
 	"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\177"
 
-	if (options.koi8_r)
-		encTemp = CP_issep CHARS_PUNCTUATION_KOI8_R CHARS_SPECIALS_KOI8_R CHARS_WHITESPACE_KOI8_R CHARS_CONTROL_KOI8_R CHARS_INVALID_KOI8_R;
-	else if (options.cp1251)
-		encTemp = CP_issep CHARS_PUNCTUATION_CP1251 CHARS_SPECIALS_CP1251 CHARS_WHITESPACE_CP1251 CHARS_CONTROL_CP1251 CHARS_INVALID_CP1251;
-	else if (options.cp866)
-		encTemp = CP_issep CHARS_PUNCTUATION_CP866 CHARS_SPECIALS_CP866 CHARS_WHITESPACE_CP866 CHARS_CONTROL_CP866 CHARS_INVALID_CP866;
-	else if (options.cp1252)
-		encTemp = CP_issep CHARS_PUNCTUATION_CP1252 CHARS_SPECIALS_CP1252 CHARS_WHITESPACE_CP1252 CHARS_CONTROL_CP1252 CHARS_INVALID_CP1252;
+	if (options.iso8859_1)
+		encTemp = CP_issep CHARS_PUNCTUATION_ISO_8859_1 CHARS_SPECIALS_ISO_8859_1 CHARS_WHITESPACE_ISO_8859_1 CHARS_CONTROL_ISO_8859_1 CHARS_INVALID_ISO_8859_1;
+	else if (options.iso8859_7 )
+		encTemp = CP_issep CHARS_PUNCTUATION_ISO_8859_7 CHARS_SPECIALS_ISO_8859_7 CHARS_WHITESPACE_ISO_8859_7 CHARS_CONTROL_ISO_8859_7 CHARS_INVALID_ISO_8859_7;
 	else if (options.iso8859_15)
 		encTemp = CP_issep CHARS_PUNCTUATION_ISO_8859_15 CHARS_SPECIALS_ISO_8859_15 CHARS_WHITESPACE_ISO_8859_15 CHARS_CONTROL_ISO_8859_15 CHARS_INVALID_ISO_8859_15;
+	else if (options.koi8_r)
+		encTemp = CP_issep CHARS_PUNCTUATION_KOI8_R CHARS_SPECIALS_KOI8_R CHARS_WHITESPACE_KOI8_R CHARS_CONTROL_KOI8_R CHARS_INVALID_KOI8_R;
 	else if (options.cp437)
 		encTemp = CP_issep CHARS_PUNCTUATION_CP437 CHARS_SPECIALS_CP437 CHARS_WHITESPACE_CP437 CHARS_CONTROL_CP437 CHARS_INVALID_CP437;
+	else if (options.cp737)
+		encTemp = CP_issep CHARS_PUNCTUATION_CP737 CHARS_SPECIALS_CP737 CHARS_WHITESPACE_CP737 CHARS_CONTROL_CP737 CHARS_INVALID_CP737;
 	else if (options.cp850)
 		encTemp = CP_issep CHARS_PUNCTUATION_CP850 CHARS_SPECIALS_CP850 CHARS_WHITESPACE_CP850 CHARS_CONTROL_CP850 CHARS_INVALID_CP850;
 	else if (options.cp858)
 		encTemp = CP_issep CHARS_PUNCTUATION_CP858 CHARS_SPECIALS_CP858 CHARS_WHITESPACE_CP858 CHARS_CONTROL_CP858 CHARS_INVALID_CP858;
-	else if (options.cp737)
-		encTemp = CP_issep CHARS_PUNCTUATION_CP737 CHARS_SPECIALS_CP737 CHARS_WHITESPACE_CP737 CHARS_CONTROL_CP737 CHARS_INVALID_CP737;
-	else if (options.iso8859_1)
-		encTemp = CP_issep CHARS_PUNCTUATION_ISO_8859_1 CHARS_SPECIALS_ISO_8859_1 CHARS_WHITESPACE_ISO_8859_1 CHARS_CONTROL_ISO_8859_1 CHARS_INVALID_ISO_8859_1;
+	else if (options.cp866)
+		encTemp = CP_issep CHARS_PUNCTUATION_CP866 CHARS_SPECIALS_CP866 CHARS_WHITESPACE_CP866 CHARS_CONTROL_CP866 CHARS_INVALID_CP866;
+	else if (options.cp1251)
+		encTemp = CP_issep CHARS_PUNCTUATION_CP1251 CHARS_SPECIALS_CP1251 CHARS_WHITESPACE_CP1251 CHARS_CONTROL_CP1251 CHARS_INVALID_CP1251;
+	else if (options.cp1252)
+		encTemp = CP_issep CHARS_PUNCTUATION_CP1252 CHARS_SPECIALS_CP1252 CHARS_WHITESPACE_CP1252 CHARS_CONTROL_CP1252 CHARS_INVALID_CP1252;
+	else if (options.cp1253)
+		encTemp = CP_issep CHARS_PUNCTUATION_CP1253 CHARS_SPECIALS_CP1253 CHARS_WHITESPACE_CP1253 CHARS_CONTROL_CP1253 CHARS_INVALID_CP1253;
 	else  // old-style ASCII-only
 		encTemp = CP_issep;
 
@@ -908,26 +924,30 @@ int initUnicode(int type) {
 	// CP_isLetter[c] will return true if c is a letter
 	memset(CP_isLetter, 0, sizeof(CP_isLetter));
 
-	if (options.koi8_r)
-		encTemp = CHARS_ALPHA_KOI8_R;
-	else if (options.cp1251)
-		encTemp = CHARS_ALPHA_CP1251;
-	else if (options.cp866)
-		encTemp = CHARS_ALPHA_CP866;
-	else if (options.cp1252)
-		encTemp = CHARS_ALPHA_CP1252;
+	if (options.iso8859_1)
+		encTemp = CHARS_ALPHA_ISO_8859_1;
+	else if (options.iso8859_7)
+		encTemp = CHARS_ALPHA_ISO_8859_7;
 	else if (options.iso8859_15)
 		encTemp = CHARS_ALPHA_ISO_8859_15;
+	else if (options.koi8_r)
+		encTemp = CHARS_ALPHA_KOI8_R;
 	else if (options.cp437)
 		encTemp = CHARS_ALPHA_CP437;
+	else if (options.cp737)
+		encTemp = CHARS_ALPHA_CP737;
 	else if (options.cp850)
 		encTemp = CHARS_ALPHA_CP850;
 	else if (options.cp858)
 		encTemp = CHARS_ALPHA_CP858;
-	else if (options.cp737)
-		encTemp = CHARS_ALPHA_CP737;
-	else if (options.iso8859_1)
-		encTemp = CHARS_ALPHA_ISO_8859_1;
+	else if (options.cp866)
+		encTemp = CHARS_ALPHA_CP866;
+	else if (options.cp1251)
+		encTemp = CHARS_ALPHA_CP1251;
+	else if (options.cp1252)
+		encTemp = CHARS_ALPHA_CP1252;
+	else if (options.cp1253)
+		encTemp = CHARS_ALPHA_CP1253;
 	else
 		encTemp = "";
 
-- 
1.7.4.1

