From 0e503517f507e4cf5227357a44ac843ac437cfd3 Mon Sep 17 00:00:00 2001
From: martin <martin@martin-ThinkPad-T410.(none)>
Date: Sun, 18 Sep 2011 19:32:39 -0400
Subject: [PATCH] CC-2838: Character encoding errors with telnet'ing show name
 to Liquidsoap

-fixed
---
 python_apps/pypo/liquidsoap_scripts/ls_script.liq | 2 ++
 python_apps/pypo/pypopush.py                      | 8 +++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/python_apps/pypo/liquidsoap_scripts/ls_script.liq b/python_apps/pypo/liquidsoap_scripts/ls_script.liq
index f47179268..03a8dbbea 100644
--- a/python_apps/pypo/liquidsoap_scripts/ls_script.liq
+++ b/python_apps/pypo/liquidsoap_scripts/ls_script.liq
@@ -58,6 +58,7 @@ if output_icecast_mp3 then
 
     #format = %mp3(bitrate=192, samplerate=44100, stereo=false)
     ignore(output.icecast(%mp3,
+            encoding = "UTF-8",
             host = icecast_host,
             port = icecast_port,
             password = icecast_pass,
@@ -75,6 +76,7 @@ end
 if output_icecast_vorbis then
     if output_icecast_vorbis_metadata then
         ignore(output.icecast(%vorbis,
+                encoding = "UTF-8",
                 host = icecast_host,
                 port = icecast_port,
                 password = icecast_pass,
diff --git a/python_apps/pypo/pypopush.py b/python_apps/pypo/pypopush.py
index 21d2a42b9..d427499a2 100644
--- a/python_apps/pypo/pypopush.py
+++ b/python_apps/pypo/pypopush.py
@@ -162,9 +162,11 @@ class PypoPush(Thread):
 
             logger.debug('Preparing to push playlist %s' % pkey)
             for item in playlist:
-                annotate = str(item['annotate'])
-                tn.write(('queue.push %s\n' % annotate).encode('latin-1'))
-                tn.write(('vars.show_name %s\n' % item['show_name']).encode('latin-1'))
+                annotate = item['annotate']
+                tn.write(str('queue.push %s\n' % annotate.encode('utf-8')))
+
+                show_name = item['show_name']
+                tn.write(str('vars.show_name %s\n' % show_name.encode('utf-8')))
 
             tn.write("exit\n")
             logger.debug(tn.read_all())