[BUG] Encoding issue, cannot download files from B2 to Local HDD. Cannot encode to CP1252 on stdout
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
The payload names no source file or test, so start by reproducing: on a Windows console with a cp1252 code page, download a B2 file whose name contains a character outside cp1252 (for example ౿) and capture the UnicodeEncodeError traceback to find the print or write call that fails. Setting PYTHONIOENCODING=utf-8 can confirm that stdout encoding is the cause. Done means the download completes and the name is shown or handled without raising. The thread has been idle for about four years, so confirm the maintainers still want this fixed before starting.
由索引模型根据 Issue 内容生成。
描述
Hello!
I discovered this issue and originally thought it was a 'Connection Pool' issue which I commented here. <-- There are a few comments in this link that pertain to this current issue #778
Scenerio
- 2-3 years ago I uploaded my files from my local HDD
-->Backblaze B2 Bucket. - (Current day) | I need to download the files from my B2 Backblaze bucket to my local HDD
- When I download the files using the
b2cli tool, I cannot complete the download due to:UnicodeEncodeError: "charmap" can't encode character "\u0c7f" in position 132: character maps to <undefined> - This error occurs in several of my files, that all have different encode character errors (not limited to:
\u0c7f).
In the comments, I was speaking to [ppolewicz]https://github.com/ppolewicz and he correctly pointed out that it is an error where they b2 python CLI tool cannot encode my file names to cp1252.
Screenshots of the errors from the B2 CLI tool
Here are some screenshots of the errors using the b2 CLI tool



In the comments, I was speaking to [ppolewicz]https://github.com/ppolewicz and he correctly pointed out that it is an error where they b2 python CLI tool cannot encode my file names to cp1252.
What I have tried
I thought that if I could identify and generate a list of the filenames which could not be encoded to cp1252, I could rename each filename to an acceptable filename which the b2 CLI tool could handle.
- I wrote a C# Console app (I can share the code if it is needed) which uses the B2.NET which is a C# .NET library that essentially queries the B2 API.
- My console app performs the following steps:
1.) Downloads all file names (and folders)
2.) Encodes the file names fromUTF-16tocp1252. When I receive the files from the B2 API, they are received inUTF-8orUTF-16format, I believe itsUTF-16.
3.) If the filename can not be encoded tocp1252, an exception would be thrown with the errors are logged, the file is marked aserrorwithin my Console App.
Expected Result:
4.) I expected that the filenames that the b2 CLI tool cannot encode to cp1252, to also throw an error within my own Console App. I expected the same files which the b2 CLI tool app has issues encoding to cp1252 also have issues within my own Console App, and my Console App would not be able to encode the same files to cp1252.
Then problematic target files that cannot be encoded to cp1252 will be marked as error within my Console App so that I could identify the problem files and rename the files using the B2 API
Actual Result:
4.) No encoding errors occurred and all file names were accurately mapped from UTF-8 or UTF-16 to cp1252 within my console app. No encoding issues occured.
Conclusion
At this point, I am somewhat at a loss and looking for direction to how I or we should fix this. I can provide anything that you guys need to help come to a solution to fix this (I would love to help too, I also wrote a Console App to help fix this).
I can share anything that you guys need including:
- My console app source code
- List of all my file names
- etc, whatever you guys need to help diagnose this.
Thanks!
- 主要语言
- Python
- 星标
- 638
- 派生
- 138
- 平均合并
- 8 小时 27 分钟
- 30 天内合并 PR
- 8
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Backblaze/B2_Command_Line_Tool 的其他 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 62/100
Backblaze/B2_Command_Line_Tool#553 · 2 条评论 · 3 个 reaction ·
维护者通常 1 天内回复
-
Adopt the AI-native SDLC playbook and repository policies可能已有人在做 @goanpeca 于 18 天前认领。 未关闭enhancement
难度 5/5 一周以上 新手友好度 25/100
Backblaze/B2_Command_Line_Tool#1192 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
Backblaze/B2_Command_Line_Tool#1168 ·
维护者通常 1 天内回复
-
Add to MacPorts未关闭
难度 3/5 1-2 天 新手友好度 50/100
Backblaze/B2_Command_Line_Tool#1161 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 56/100
Backblaze/B2_Command_Line_Tool#1155 ·
维护者通常 1 天内回复
查看 Backblaze/B2_Command_Line_Tool 的全部 Issue
相似的 Issue
-
ライブラリを追加未关闭priority middle
难度 1/5 1 小时以内 新手友好度 62/100
KATO-Hiro/AtCoderClans#13015 ·
维护者通常 1 天内回复
-
StringLiteral to IntegerType/LongType silently truncates fractional strings, changing predicate meaning可能已有人在做 @Shahzeb-DataEngineer 今天认领。 未关闭kind:bug
难度 2/5 1-3 小时 新手友好度 68/100
apache/iceberg-python#4382 · 2 条评论 ·
维护者通常 1 天内回复
-
request-theme
难度 2/5 1 小时以内 新手友好度 62/100
LizardByte/ThemerrDB#10024 · 2 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 72/100
btclib-org/btclib-node#2505 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
open-webui/open-webui#34462 · 1 条评论 ·
维护者通常 1 天内回复