From b8300bfb82ae64d30e874b009af8a55f9aa44db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= Date: Mon, 29 Jan 2007 19:12:31 +0100 Subject: [PATCH] ID3: Ignore characters that are not supported by Latin-1. (#2399) --- picard/formats/id3.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/picard/formats/id3.py b/picard/formats/id3.py index 656a425a7..9adb0c787 100644 --- a/picard/formats/id3.py +++ b/picard/formats/id3.py @@ -25,6 +25,16 @@ from picard.file import File from picard.formats.mutagenext import compatid3 from picard.util import encode_filename + +# Ugly, but... I need to save the text in ISO-8859-1 even if it contains +# unsupported characters and this better than encoding, decoding and +# again encoding. +def patched_EncodedTextSpec_write(self, frame, value): + enc, term = self._encodings[frame.encoding] + return value.encode(enc, 'ignore') + term +id3.EncodedTextSpec.write = patched_EncodedTextSpec_write + + class ID3File(File): """Generic ID3-based file.""" _File = None