Skip to content

Commit

Permalink
Small change to prevent crashes on accented characters.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaswwp committed Nov 18, 2013
1 parent fded8e8 commit fb5a982
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pylms/server.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This Python file uses the following encoding: utf-8
"""
PyLMS: Python Wrapper for Logitech Media Server CLI
(Telnet) Interface
Expand All @@ -21,6 +22,7 @@

import telnetlib
from pylms.player import Player
import unicodedata # for handling (badly) accented characters


class Server(object):
Expand Down Expand Up @@ -95,6 +97,7 @@ def request(self, command_string, preserve_encoding=False):
else:
result = response[len(command_string_quoted)-1:]
result = result.strip()
result = unicodedata.normalize('NFD', result).encode('ascii','ignore')
return result

def request_with_results(self, command_string, preserve_encoding=False):
Expand Down

0 comments on commit fb5a982

Please sign in to comment.