From bfba4b35ab9dbc842cc7d6e5458dfd7c720b0893 Mon Sep 17 00:00:00 2001 From: David Howden Date: Mon, 9 May 2016 22:37:03 +1000 Subject: [PATCH 1/2] Updated text decoding to fallback to ISO-8859-1. See #20 for more details. --- id3v2frames.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/id3v2frames.go b/id3v2frames.go index 8e66457..1a5b20f 100644 --- a/id3v2frames.go +++ b/id3v2frames.go @@ -337,8 +337,8 @@ func decodeText(enc byte, b []byte) (string, error) { case 3: // UTF-8 return string(b), nil - default: - return "", fmt.Errorf("invalid encoding byte %x", enc) + default: // Fallback to ISO-8859-1 + return decodeISO8859(b), nil } } From 9daeb8310559df93ee573039dcc10c145d9fa508 Mon Sep 17 00:00:00 2001 From: David Howden Date: Mon, 9 May 2016 22:40:03 +1000 Subject: [PATCH 2/2] Update delimiter to fallback to ISO-8859-1. --- id3v2frames.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/id3v2frames.go b/id3v2frames.go index 1a5b20f..16083a7 100644 --- a/id3v2frames.go +++ b/id3v2frames.go @@ -348,8 +348,8 @@ func encodingDelim(enc byte) ([]byte, error) { return []byte{0}, nil case 1, 2: // see decodeText above return []byte{0, 0}, nil - default: - return nil, fmt.Errorf("invalid encoding byte %x", enc) + default: // see decodeText above + return []byte{0}, nil } }