diff options
author | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-06-14 12:08:19 +0200 |
---|---|---|
committer | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-06-14 12:08:19 +0200 |
commit | 9b2786d392c7dd0ef1c86c70bf47c02cdafefe77 (patch) | |
tree | 240755ac64d4a79a79a4129492656d5c40a83582 /junklib.c | |
parent | 718c8cb8d796353565033231e1bd5f8f55e29f05 (diff) |
made shift-jis detector optional and configurable
Diffstat (limited to 'junklib.c')
-rw-r--r-- | junklib.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -57,6 +57,7 @@ uint16_t sj_to_unicode[] = { int enable_cp1251_detection = 1; int enable_cp936_detection = 0; +int enable_shift_jis_detection = 0; #define MAX_TEXT_FRAME_SIZE 1024 #define MAX_CUESHEET_FRAME_SIZE 10000 @@ -713,6 +714,9 @@ 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) { @@ -4111,9 +4115,16 @@ junk_enable_cp936_detection (int enable) { } void +junk_enable_shift_jis_detection (int enable) { + enable_shift_jis_detection = enable; +} + +void junk_configchanged (void) { int cp1251 = conf_get_int ("junk.enable_cp1251_detection", 1); int cp936 = conf_get_int ("junk.enable_cp936_detection", 0); + int shift_jis = conf_get_int ("junk.enable_shift_jis_detection", 0); junk_enable_cp1251_detection (cp1251); junk_enable_cp936_detection (cp936); + junk_enable_shift_jis_detection (shift_jis); } |