diff options
author | 2010-01-15 22:19:21 +0100 | |
---|---|---|
committer | 2010-01-15 22:19:21 +0100 | |
commit | cc3c9383d0ba49363eded879f2bbef3f833df39c (patch) | |
tree | 0861a2c54d028fdaa155e9499be0b1e119850ddf /junklib.c | |
parent | 3b39d6d38aa9d5f27b9d44a19151f4c1998cb584 (diff) |
better (?) charset detection for id3v2.4 tags
Diffstat (limited to 'junklib.c')
-rw-r--r-- | junklib.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -316,12 +316,7 @@ convstr_id3v2_4 (const unsigned char* str, int sz) { // hack to add limited cp1251 recoding support - if (*str == 0) { - // iso8859-1 - trace ("iso8859-1\n"); - enc = "iso8859-1"; - } - else if (*str == 3) { + if (*str == 3) { // utf8 trace ("utf8\n"); strncpy (out, str+1, 2047); @@ -337,6 +332,14 @@ convstr_id3v2_4 (const unsigned char* str, int sz) { trace ("utf16be\n"); enc = "UTF-16BE"; } +#if 0 + // NOTE: some dumb taggers put non-iso8859-1 text with enc=0 + else if (*str == 0) { + // iso8859-1 + trace ("iso8859-1\n"); + enc = "iso8859-1"; + } +#endif else { if (can_be_russian (&str[1])) { enc = "cp1251"; @@ -815,6 +818,10 @@ junk_read_id3v2 (playItem_t *it, DB_FILE *fp) { else if (version_major == 3) { sz = (readptr[3] << 0) | (readptr[2] << 8) | (readptr[1] << 16) | (readptr[0] << 24); } + else { + trace ("unknown id3v2 version (2.%d.%d)\n", version_major, version_minor); + return -1; + } readptr += 4; trace ("got frame %s, size %d, pos %d, tagsize %d\n", frameid, sz, readptr-tag, size); if (readptr - tag >= size - sz) { |