diff --git a/src-python/webui_controller.py b/src-python/webui_controller.py index 619a24c2..61db6aec 100644 --- a/src-python/webui_controller.py +++ b/src-python/webui_controller.py @@ -297,7 +297,7 @@ def replaceExclamationsWithRandom(text): def replace(match): original = match.group(1) nonlocal num - rand_value = hex(num) + rand_value = f" <$ {hex(num)}> " replacement_dict[rand_value] = original num += 1 return str(rand_value) @@ -311,7 +311,7 @@ def restoreText(escaped_text, escape_dict): # 大文字小文字を無視して置換するために、正規表現を使う for escape_seq, char in escape_dict.items(): # escape_seq の部分を case-insensitive で置換 - escaped_text = re.sub(re.escape(escape_seq), char, escaped_text, flags=re.IGNORECASE) + escaped_text = re.sub(re.escape(escape_seq[1:-1]), char, escaped_text, flags=re.IGNORECASE) return escaped_text def removeExclamations(text):