Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

Apply suggestions from code review

Nick Sweeting753f29ce3775
diff --git a/browser_use/agent/gif.py b/browser_use/agent/gif.py
index 72056306e..682007c58 100644
--- a/browser_use/agent/gif.py
+++ b/browser_use/agent/gif.py
@@ -17,8 +17,10 @@ if TYPE_CHECKING:
logger = logging.getLogger(__name__)
# Add Chinese support to the pictures on the GIF
-def decode_unicode_escapes_to_chinese(text: str) -> str:
+def decode_unicode_escapes_to_utf8(text: str) -> str:
"""Decode Unicode escape sequences in a string."""
+ if r'\u' not in text:
+ return text # doesnt have any unicode escape sequences that need to be decoded
try:
# Try to decode Unicode escape sequences
return text.encode('latin1').decode('unicode_escape')