From d1bb616aae8a11afef2627cf8a8d166156a05cf7 Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Fri, 25 Mar 2011 23:08:27 +0100 Subject: fixed encoding problems. again. diff --git a/program/management/commands/importhosts.py b/program/management/commands/importhosts.py index dcdf4be..39a8afd 100644 --- a/program/management/commands/importhosts.py +++ b/program/management/commands/importhosts.py @@ -22,7 +22,7 @@ WHERE letzter_termin > current_date AND macher != '' AND titel NOT LIKE 'Musikpr counter = 0 for row in cursor.fetchall(): - for macher in row[0].decode('latin1').encode('utf8').split(','): + for macher in row[0].split(','): host = Host(name=macher.strip()) host.save() diff --git a/program/management/commands/importnotes.py b/program/management/commands/importnotes.py index a8030ec..19ddfed 100644 --- a/program/management/commands/importnotes.py +++ b/program/management/commands/importnotes.py @@ -26,9 +26,9 @@ WHERE n.sendung_id in (SELECT id FROM sendungen WHERE letzter_termin > current_d counter = 0 for ntitel, datum, stitel, notiz in cursor.fetchall(): - ntitel = strip_tags(ntitel.decode('latin1').encode('utf8')) - stitel = strip_tags(stitel.decode('latin1').encode('utf8')) - notiz = clean_html(notiz.decode('latin1').encode('utf8')) + ntitel = strip_tags(ntitel) + stitel = strip_tags(stitel) + notiz = clean_html(notiz) if stitel.endswith('(Wiederholung)'): stitel = stitel[:-15] diff --git a/program/management/commands/importprogramslots.py b/program/management/commands/importprogramslots.py index 8739bbb..52aa73a 100644 --- a/program/management/commands/importprogramslots.py +++ b/program/management/commands/importprogramslots.py @@ -32,7 +32,7 @@ WHERE letzter_termin > current_date AND titel NOT LIKE 'Musikprogramm' AND titel counter = 0 for titel, beginn, ende, erster_termin, letzter_termin, rhytmus, termin in cursor.fetchall(): - titel = strip_tags(titel.decode('latin1').encode('utf8')) + titel = strip_tags(titel) hours, seconds = divmod(beginn.seconds, 3600) minutes, seconds = divmod(seconds, 60) @@ -64,7 +64,7 @@ FROM sendungen WHERE letzter_termin > current_date AND titel LIKE '%%(Wiederholung)'""") for titel, beginn, ende, erster_termin, letzter_termin, rhytmus, termin in cursor.fetchall(): - titel = titel.decode('latin1').encode('utf8')[:-15] + titel = strip_tags(titel[:-15]) hours, seconds = divmod(beginn.seconds, 3600) minutes, seconds = divmod(seconds, 60) diff --git a/program/management/commands/importshows.py b/program/management/commands/importshows.py index 9fee4ef..b013dab 100644 --- a/program/management/commands/importshows.py +++ b/program/management/commands/importshows.py @@ -28,14 +28,14 @@ ORDER BY titel, beginn, ende""") counter = 0 for titel, beschreibung, web, macher in cursor.fetchall(): - titel = strip_tags(titel.decode('latin1').encode('utf8')) - beschreibung = clean_html(beschreibung.decode('latin1').encode('utf8')) + titel = strip_tags(titel) + beschreibung = clean_html(beschreibung) slug = slugify(titel) hosts = [] - for macher in macher.decode('latin1').encode('utf8').split(','): + for macher in macher.split(','): macher = macher.strip() try: host = Host.objects.get(name=macher) -- cgit v0.10.2