diff options
Diffstat (limited to 'junklib.c')
-rw-r--r-- | junklib.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -714,9 +714,6 @@ can_be_chinese (const uint8_t *str, int sz) { static int can_be_shift_jis (const unsigned char *str, int size) { - if (!enable_shift_jis_detection) { - return 0; - } unsigned char out[size*4]; if (size < 2) { @@ -3674,7 +3671,7 @@ junk_detect_charset_len (const char *s, int len) { return NULL; // means no recoding required } // try shift-jis - if (len > 10 && can_be_shift_jis (s, len)) { + if (enable_shift_jis_detection && can_be_shift_jis (s, len)) { return "shift-jis"; } // hack to add cp936 support @@ -3686,6 +3683,12 @@ junk_detect_charset_len (const char *s, int len) { return "cp1251"; } + // if shift_jis detection is disabled, but russian and chinese failed, + // try it anyway + if (!enable_shift_jis_detection && can_be_shift_jis (s, len)) { + return "shift_jis"; + } + return "cp1252"; } |