diff --git a/epan/charsets.c b/epan/charsets.c index 38d191d058..d713c45dfe 100644 --- a/epan/charsets.c +++ b/epan/charsets.c @@ -419,6 +419,26 @@ const gunichar2 charset_table_cp1250[0x80] = { 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, /* - 0xFF */ }; +/* Windows-1251 (http://en.wikipedia.org/wiki/Windows-1251) */ +const gunichar2 charset_table_cp1251[0x80] = { + 0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, /* 0x80 - */ + UNREPL, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040B, 0x040f, /* - 0x8F */ + 0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, /* 0x90 - */ + UNREPL, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f, /* - 0x9F */ + 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, /* 0xA0 - */ + 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, /* - 0xAF */ + 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, /* 0xB0 - */ + 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457, /* - 0xBF */ + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, /* 0xC0 - */ + 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, /* - 0xCF */ + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, /* 0xD0 - */ + 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, /* - 0xDF */ + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, /* 0xE0 - */ + 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, /* - 0xEF */ + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, /* 0xF0 - */ + 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, /* - 0xFF */ +}; + /* generated by ./make_charset_table MACROMAN */ /* That's "MacRoman", not "Macro Man" (faster than a speeding recursive expansion!) */ const gunichar2 charset_table_mac_roman[0x80] = { @@ -460,6 +480,46 @@ const gunichar2 charset_table_cp437[0x80] = { 0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2, 0x25a0, 0x00a0, /* - 0xFF */ }; +/* CP855 (http://en.wikipedia.org/wiki/CP855) */ +const gunichar2 charset_table_cp855[0x80] = { + 0x0452, 0x0402, 0x0453, 0x0403, 0x0451, 0x0401, 0x0454, 0x0404, /* 0x80 - */ + 0x0455, 0x0405, 0x0456, 0x0406, 0x0457, 0x0407, 0x0458, 0x0408, /* - 0x8F */ + 0x0459, 0x0409, 0x045a, 0x040a, 0x045b, 0x040b, 0x045c, 0x040c, /* 0x90 - */ + 0x045e, 0x040e, 0x045f, 0x040f, 0x044e, 0x042e, 0x044a, 0x042a, /* - 0x9F */ + 0x0430, 0x0410, 0x0431, 0x0411, 0x0446, 0x0426, 0x0434, 0x0414, /* 0xA0 - */ + 0x0435, 0x0415, 0x0444, 0x0424, 0x0433, 0x0413, 0x00ab, 0x00bb, /* - 0xAF */ + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x0445, 0x0425, 0x0438, /* 0xB0 - */ + 0x0418, 0x2563, 0x2551, 0x2557, 0x2550, 0x0439, 0x0419, 0x2510, /* - 0xBF */ + 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x043a, 0x041a, /* 0xC0 - */ + 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x00a4, /* - 0xCF */ + 0x043b, 0x041b, 0x043c, 0x041c, 0x043d, 0x041d, 0x043e, 0x041e, /* 0xD0 - */ + 0x043f, 0x2518, 0x250c, 0x2588, 0x2584, 0x041f, 0x044f, 0x2580, /* - 0xDF */ + 0x042f, 0x0440, 0x0420, 0x0441, 0x0421, 0x0442, 0x0422, 0x0443, /* 0xE0 - */ + 0x0423, 0x0436, 0x0416, 0x0432, 0x0412, 0x044c, 0x042c, 0x2116, /* - 0xEF */ + 0x00ad, 0x044b, 0x042b, 0x0437, 0x0417, 0x0448, 0x0428, 0x044d, /* 0xF0 - */ + 0x042d, 0x0449, 0x0429, 0x0447, 0x0427, 0x00a7, 0x25a0, 0x00a0, /* - 0xFF */ +}; + +/* CP855 (http://en.wikipedia.org/wiki/CP866) */ +const gunichar2 charset_table_cp866[0x80] = { + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, /* 0x80 - */ + 0x0418, 0x0419, 0x041A, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, /* - 0x8F */ + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, /* 0x90 - */ + 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, /* - 0x9F */ + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, /* 0xA0 - */ + 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, /* - 0xAF */ + 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, /* 0xB0 - */ + 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510, /* - 0xBF */ + 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f, /* 0xC0 - */ + 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567, /* - 0xCF */ + 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b, /* 0xD0 - */ + 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580, /* - 0xDF */ + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, /* 0xE0 - */ + 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, /* - 0xEF */ + 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040e, 0x045e, /* 0xF0 - */ + 0x00b0, 0x2219, 0x00b7, 0x221a, 0x2216, 0x00a4, 0x25a0, 0x00a0, /* - 0xFF */ +}; + /* * Given a wmem scope, a pointer, a length, and a translation table, * treat the string of bytes referred to by the pointer and length as a diff --git a/epan/charsets.h b/epan/charsets.h index 524c316660..39c469172a 100644 --- a/epan/charsets.h +++ b/epan/charsets.h @@ -24,6 +24,8 @@ extern "C" { /* Table for windows-1250 */ extern const gunichar2 charset_table_cp1250[0x80]; +/* Table for windows-1251 */ +extern const gunichar2 charset_table_cp1251[0x80]; /* Tables for ISO-8859-X */ extern const gunichar2 charset_table_iso_8859_2[0x80]; @@ -46,6 +48,9 @@ extern const gunichar2 charset_table_mac_roman[0x80]; /* Tables for DOS code pages */ extern const gunichar2 charset_table_cp437[0x80]; +extern const gunichar2 charset_table_cp855[0x80]; +extern const gunichar2 charset_table_cp866[0x80]; + /* Tables for EBCDIC code pages */ extern const gunichar2 charset_table_ebcdic[256]; diff --git a/epan/proto.h b/epan/proto.h index afe8dae6e2..2121e4e874 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -472,8 +472,9 @@ void proto_report_dissector_bug(const char *format, ...) #define ENC_T61 0x00000036 #define ENC_EBCDIC_CP037 0x00000038 #define ENC_ZIGBEE 0x0000003A - - +#define ENC_WINDOWS_1251 0x0000003C +#define ENC_CP855 0x0000003E +#define ENC_CP866 0x00000040 /* * TODO: * diff --git a/epan/tvbuff.c b/epan/tvbuff.c index 110c437437..9777508f29 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -2809,6 +2809,10 @@ tvb_get_string_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, strptr = tvb_get_string_unichar2(scope, tvb, offset, length, charset_table_cp1250); break; + case ENC_WINDOWS_1251: + strptr = tvb_get_string_unichar2(scope, tvb, offset, length, charset_table_cp1251); + break; + case ENC_MAC_ROMAN: strptr = tvb_get_string_unichar2(scope, tvb, offset, length, charset_table_mac_roman); break; @@ -2817,6 +2821,14 @@ tvb_get_string_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, strptr = tvb_get_string_unichar2(scope, tvb, offset, length, charset_table_cp437); break; + case ENC_CP855: + strptr = tvb_get_string_unichar2(scope, tvb, offset, length, charset_table_cp855); + break; + + case ENC_CP866: + strptr = tvb_get_string_unichar2(scope, tvb, offset, length, charset_table_cp866); + break; + case ENC_3GPP_TS_23_038_7BITS: { gint bit_offset = offset << 3;