Fix UTF-8 time issue (#131)

This commit is contained in:
Etoh 2017-04-16 00:05:53 +01:00
parent 31ecb7494e
commit c7e7114d37
3 changed files with 5 additions and 5 deletions

View File

@ -1341,7 +1341,7 @@ class UiManager(object):
def showDebugMessage(self, message):
if constants.DEBUG_MODE and message.rstrip():
sys.stderr.write("{}{}\n".format(time.strftime(constants.UI_TIME_FORMAT, time.localtime()),message.rstrip()))
sys.stderr.write("{}{}\n".format(time.strftime(constants.UI_TIME_FORMAT, time.localtime()).decode('utf-8'),message.rstrip()))
def showMessage(self, message, noPlayer=False, noTimestamp=False, secondaryOSD=False):
if not noPlayer: self.showOSDMessage(message, duration=constants.OSD_DURATION, secondaryOSD=secondaryOSD)

View File

@ -94,7 +94,7 @@ class ConsoleUI(threading.Thread):
if noTimestamp:
print(message)
else:
print(time.strftime(constants.UI_TIME_FORMAT, time.localtime()) + message)
print(time.strftime(constants.UI_TIME_FORMAT, time.localtime()).decode('utf-8') + message)
def showDebugMessage(self, message):
print(message)

View File

@ -349,7 +349,7 @@ class MainWindow(QtGui.QMainWindow):
if noTimestamp:
self.newMessage(u"{}<br />".format(message))
else:
self.newMessage(time.strftime(constants.UI_TIME_FORMAT, time.localtime()) + message + u"<br />")
self.newMessage(time.strftime(constants.UI_TIME_FORMAT, time.localtime()).decode('utf-8') + message + u"<br />")
@needsClient
def getFileSwitchState(self, filename):
@ -370,7 +370,7 @@ class MainWindow(QtGui.QMainWindow):
@needsClient
def isItemUntrusted(self, filename):
return isURL(filename) and not self._syncplayClient.isURITrusted(filename)
@needsClient
def isFileAvailable(self, filename):
if filename:
@ -681,7 +681,7 @@ class MainWindow(QtGui.QMainWindow):
message = message.replace(u"&", u"&amp;").replace(u'"', u"&quot;").replace(u"<", u"&lt;").replace(u">", u"&gt;")
message = message.replace(u"\n", u"<br />")
message = u"<span style=\"{}\">".format(constants.STYLE_ERRORNOTIFICATION) + message + u"</span>"
self.newMessage(time.strftime(constants.UI_TIME_FORMAT, time.localtime()) + message + u"<br />")
self.newMessage(time.strftime(constants.UI_TIME_FORMAT, time.localtime()).decode('utf-8') + message + u"<br />")
@needsClient
def joinRoom(self, room=None):