♻️ Refactor: Missing UTF-8 encoding in file open#439
♻️ Refactor: Missing UTF-8 encoding in file open#439tang-vu wants to merge 1 commit intolepture:mainfrom
Conversation
The `open(filepath, "r")` call does not specify an encoding. In Python, this defaults to the system's default encoding (e.g., `cp1252` on Windows). If the Markdown files contain emojis or other non-ASCII characters, this will raise a `UnicodeDecodeError` on those platforms. Affected files: bench.py
|
|
u should stop using AI for trivial pr. this useless bench read file refactor assumes no one designs files bench contain complex chars like Chinese, emoji |
If you have too much free time, just cry by yourself, lè nhà lè nhè Syu Ng ạ |
|
Thắng sao được trùm AI, xoá comment nhanh còn kịp |
Cứ thế thôi, đây là cả 1 hội rủ nhau bait à |
| else: | ||
| filepath = os.path.join(ROOT_DIR, "cases", filename) | ||
| with open(filepath, "r") as f: | ||
| with open(filepath, "r", encoding="utf-8") as f: |
There was a problem hiding this comment.
bro, these bench files havent changed in 4 years and CI is been green, this just benchmarks markdown rendering (### headers, links, >, ..) not Chinese text or emoji parsing
pure ai slop. close pls
There was a problem hiding this comment.
Do professional mourners get paid for their work? Can I work with you?
Ko, em ghét thằng kia lắm ạ, cứ dùng AI code rồi tưởng mình thượng đẳng |
Nhắc lại từ facebook nhé người đẹp |
A đoán nhé, là nhóc kia 2k9 thật à, chứ người trưởng thành ai rảnh đâu mà chăm chỉ vác tù và hàng tổng vậy, kể cả người toxic người ta cũng chẳng rảnh vậy. |
E bị nó chửi ác lắm anh ơi 😭🤬 ko đùaa |
Vui mà, nhiệt tình, nói chung là cũng k ghét lắm, chỉ là hơi phiền thôi |



♻️ Refactoring
Problem
The
open(filepath, "r")call does not specify an encoding. In Python, this defaults to the system's default encoding (e.g.,cp1252on Windows). If the Markdown files contain emojis or other non-ASCII characters, this will raise aUnicodeDecodeErroron those platforms.Severity:
mediumFile:
benchmark/bench.pySolution
Explicitly specify the encoding by changing the line to:
with open(filepath, "r", encoding="utf-8") as f:Changes
benchmark/bench.py(modified)Testing
🤖 About this PR
This pull request was generated by ContribAI, an AI agent
that helps improve open source projects. The change was:
If you have questions or feedback about this PR, please comment below.
We appreciate your time reviewing this contribution!