Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: Different output upon decoding invalid utf-8

未关闭
#875 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
python
领域
backend

调研方向

从报告中的 graalpy -c 解码复现开始,针对提供的无效 UTF-8 字节,将其 errors='replace' 输出与 CPython 进行比较。跟踪解码入口点,确定无效三元组在哪里被分组,然后验证输出是否符合 CPython 的替换行为。

由索引模型根据 Issue 内容生成。

描述

bug
Describe the bug

Not sure whether it is a bug or just a different behaviour.
Not critical either way, but thought filing it for reference anyway.

  • When decoding invalid UTF-8 with errors='replace', CPython (and PyPy for that matter) decodes every invalid byte as �.
  • GraalPy, OTOH, treats invalid UTF-8 triplets as one character.
Operating system

Linux

CPU architecture

x86_64

GraalPy version

GraalPy 3.12.8 (GraalVM CE Native 25.0.2)

JDK version

No response

Context configuration

No response

Steps to reproduce

GraalPy:

$ graalpy -c "print(b'\xed\xae\x80\xed\xb0\x80'.decode(errors='replace'))"
��

CPython:

$ python -c "print(b'\xed\xae\x80\xed\xb0\x80'.decode(errors='replace'))"
������
Expected behavior

To match CPython unless there is a good reason not to.

Stack trace

Additional context

No response

主要语言
Python
星标
1.7k
派生
155
平均合并
7 小时 16 分钟
30 天内合并 PR
51

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

oracle/graalpython 的其他 Issue

查看 oracle/graalpython 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。