From 38cbc56526c934009ca24370f00f45e1cb460919 Mon Sep 17 00:00:00 2001 From: "panghewen.phw" Date: Fri, 13 Feb 2026 15:28:32 +0800 Subject: [PATCH] fix: preserve non-ASCII characters in tool input when extracting conversations Add ensure_ascii=False to json.dumps() when serializing tool_use input in extract_claude_logs.py so that CJK and other non-ASCII text (e.g. Chinese metric/dimension names in MCP tool calls) are shown as readable characters instead of \uXXXX escape sequences in exported logs. Co-authored-by: Cursor --- src/extract_claude_logs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/extract_claude_logs.py b/src/extract_claude_logs.py index 8430825..e179892 100644 --- a/src/extract_claude_logs.py +++ b/src/extract_claude_logs.py @@ -122,7 +122,7 @@ def extract_conversation(self, jsonl_path: Path, detailed: bool = False) -> List conversation.append( { "role": "tool_use", - "content": f"šŸ”§ Tool: {tool_name}\nInput: {json.dumps(tool_input, indent=2)}", + "content": f"šŸ”§ Tool: {tool_name}\nInput: {json.dumps(tool_input, indent=2, ensure_ascii=False)}", "timestamp": entry.get("timestamp", ""), } ) @@ -183,7 +183,7 @@ def _extract_text_content(self, content, detailed: bool = False) -> str: tool_name = item.get("name", "unknown") tool_input = item.get("input", {}) text_parts.append(f"\nšŸ”§ Using tool: {tool_name}") - text_parts.append(f"Input: {json.dumps(tool_input, indent=2)}\n") + text_parts.append(f"Input: {json.dumps(tool_input, indent=2, ensure_ascii=False)}\n") return "\n".join(text_parts) else: return str(content)