Fix escape issue with some non-alphanumeric characters in chat

This commit is contained in:
Etoh 2017-05-28 15:45:44 +01:00
parent 1c6e35f58a
commit 546901a55b
2 changed files with 3 additions and 2 deletions

View File

@ -357,6 +357,7 @@ function handle_enter()
if line == '' then
return
end
line = string.gsub(line,"\\", "\\\\")
line = string.gsub(line,"\"", "\\\"")
mp.command('print-text "<chat>'..line..'</chat>"')
clear()

View File

@ -96,7 +96,6 @@ class MplayerPlayer(BasePlayer):
username = self._sanitizeText(username)
message = self._sanitizeText(message)
messageString = u"<{}> {}".format(username, message)
messageString = self._sanitizeText(messageString)
self._listener.sendLine(u'script-message-to syncplayintf chat "{}"'.format(messageString))
def setSpeed(self, value):
@ -143,7 +142,8 @@ class MplayerPlayer(BasePlayer):
text = text.replace("\n", "")
text = text.replace("\\\"", "<SYNCPLAY_QUOTE>")
text = text.replace("\"", "<SYNCPLAY_QUOTE>")
text = text.replace("\\", u"\\\\\\uFEFF")
text = text.replace("%", "%%")
text = text.replace("\\", "\\\\")
text = text.replace("{", "\\\\{")
text = text.replace("}", "\\\\}")
text = text.replace("}", "\\\\}")