From 7d03a08757cac67062cc1ae53b7f9354071424e8 Mon Sep 17 00:00:00 2001 From: rany2 Date: Sat, 3 May 2025 13:28:50 +0300 Subject: [PATCH] XML unescape WordBoundary text sent from metadata (#378) Turns out Microsoft sends them XML escaped even though it's in JSON... Signed-off-by: rany --- src/edge_tts/communicate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/edge_tts/communicate.py b/src/edge_tts/communicate.py index 433e994..aa45165 100644 --- a/src/edge_tts/communicate.py +++ b/src/edge_tts/communicate.py @@ -20,7 +20,7 @@ from typing import ( Tuple, Union, ) -from xml.sax.saxutils import escape +from xml.sax.saxutils import escape, unescape import aiohttp import certifi @@ -401,7 +401,7 @@ class Communicate: "type": meta_type, "offset": current_offset, "duration": current_duration, - "text": meta_obj["Data"]["text"]["Text"], + "text": unescape(meta_obj["Data"]["text"]["Text"]), } if meta_type in ("SessionEnd",): continue