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

Uppercase "UTF-8" encoding name no longer works in CircuitPython 11

已关闭
#11,580 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
半天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
c, python
领域
embedded-iot

调研方向

The payload names no source files. Start from the encoding check that micropython/micropython#18854 and #19474 introduced, which accepts only utf-8, utf8 and ascii exactly, and reproduce with bytes("hi", "UTF-8") on a CircuitPython 11 build. The open question is whether the core should match names case-insensitively or the libraries should change, so settle that with the maintainers before writing a patch. Done means the chosen behaviour is agreed and "UTF-8" either encodes correctly or is documented as unsupported.

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

描述

bug cpython api

Passing "UTF-8" as an encoding raises LookupError on CircuitPython 11.

It worked on 10.x and works in CPython.

>>> bytes("hi", "utf-8")
b'hi'
>>> bytes("hi", "UTF-8")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
LookupError: unknown encoding: UTF-8
>>> "hi".encode("UTF-8")
LookupError: unknown encoding: UTF-8
Board Version "UTF-8"
Feather RP2040 RFM 11.0.0-alpha.1 LookupError
Fruit Jam 11.0.0-alpha.1-71-g36a5653882 LookupError
Metro RP2350 11.0.0-alpha.0-22-g4453bba9a1 LookupError
(10.3.x source) no encoding check

The check came from micropython/micropython#18854 and micropython/micropython#19474, which accept only utf-8, utf8 and ascii exactly.

It breaks 9 of the 14 examples in adafruit/Adafruit_CircuitPython_RFM#26, and code search finds about 340 adafruit Python files using "UTF-8").

Should CircuitPython match encoding names case-insensitively, or should we fix the libraries?

Found with help from Claude Code. The REPL output is from the boards above.

主要语言
C
星标
4.6k
派生
1.4k
平均合并
23 小时 40 分钟
30 天内合并 PR
167

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

adafruit/circuitpython 的其他 Issue

查看 adafruit/circuitpython 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

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