From 9263020c3050db6a57c7370bca2b0118ce2b088e Mon Sep 17 00:00:00 2001 From: Ghraven Date: Mon, 25 May 2026 01:19:42 +0800 Subject: [PATCH] fix: read validator text files as utf-8 --- src/openai/lib/_validators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openai/lib/_validators.py b/src/openai/lib/_validators.py index cf24cd2294..a947283641 100644 --- a/src/openai/lib/_validators.py +++ b/src/openai/lib/_validators.py @@ -482,7 +482,7 @@ def read_any_format( elif fname.lower().endswith(".txt"): immediate_msg = "\n- Based on your file extension, you provided a text file" necessary_msg = "Your format `TXT` will be converted to `JSONL`" - with open(fname, "r") as f: + with open(fname, "r", encoding="utf-8") as f: content = f.read() df = pd.DataFrame( [["", line] for line in content.split("\n")],