summaryrefslogtreecommitdiff
path: root/junklib.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-06-13 19:11:37 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-06-13 19:11:37 +0200
commit055ca014541453a3a2e07db6902b16f9406bf530 (patch)
tree861c62dc5aff4db7536278c9c8940b5033265613 /junklib.c
parenta46e39c5bc58d77a376652fe7f85f9c5b3b8e67b (diff)
improved cuesheet charset detection
Diffstat (limited to 'junklib.c')
-rw-r--r--junklib.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/junklib.c b/junklib.c
index 05e58fc9..37692c96 100644
--- a/junklib.c
+++ b/junklib.c
@@ -3639,15 +3639,13 @@ junk_id3v2_read (playItem_t *it, DB_FILE *fp) {
}
const char *
-junk_detect_charset (const char *s) {
- size_t len = strlen (s);
-
+junk_detect_charset_len (const char *s, int len) {
// check if that's already utf8
if (u8_valid (s, len, NULL)) {
return NULL; // means no recoding required
}
// try shift-jis
- if (can_be_shift_jis (s, len)) {
+ if (len > 10 && can_be_shift_jis (s, len)) {
return "shift-jis";
}
// hack to add cp936 support
@@ -3662,6 +3660,12 @@ junk_detect_charset (const char *s) {
return "cp1252";
}
+const char *
+junk_detect_charset (const char *s) {
+ size_t len = strlen (s);
+ return junk_detect_charset_len (s, len);
+}
+
int
junk_recode (const char *in, int inlen, char *out, int outlen, const char *cs) {
return junk_iconv (in, inlen, out, outlen, cs, UTF8_STR);