GzipReader: internal_encoding option overwrites external_encoding
还没有人认领这个 Issue。
评估
调研方向
首先,在 Ruby 3.3.1 上重现 issue 中的两个 GzipReader 示例,并将它们的 encoding 行为与 File.open 进行比较。跟踪 zlib repository 中的 GzipReader API 和 encoding 处理;当同时提供 internal_encoding 时 external_encoding 仍保持为 ISO-8859-1,并且 internal_encoding 的预期行为已确定,即表示完成。
由索引模型根据 Issue 内容生成。
描述
(Ruby version 3.3.1)
Hi!
When I specify the internal_encoding option to GzipReader.open or GzipReader.new, this seems to override whatever was set by the external_encoding option.
Example:
When not specifying internal_encoding, we get the expected external_encoding:
Zlib::GzipReader.open('myfile.gz', external_encoding: 'iso-8859-1') do |gz|
puts gz.external_encoding
end
output:
ISO-8859-1
But with internal_encoding specified, external_encoding is changed:
Zlib::GzipReader.open('myfile.gz', external_encoding: 'iso-8859-1', internal_encoding: 'utf-8') do |gz|
puts gz.external_encoding
end
output:
UTF-8
This seems broken, right? I'm not getting the problem with File.open.
Additionally, I noticed GzipReader does not respond to internal_encoding:
Zlib::GzipReader.open('myfile.gz') do |gz|
puts gz.internal_encoding
end
This throws NoMethodError with message:
undefined method `internal_encoding' for #<Zlib::GzipReader:0x00007f4c616a4e10> (NoMethodError)
Did you mean? external_encoding
Regards,
Olof
- 主要语言
- C
- 星标
- 73
- 派生
- 40
- 平均合并
- 10 小时 32 分钟
- 30 天内合并 PR
- 2
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ruby/zlib 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 72/100
-
难度 3/5 1-2 天 新手友好度 55/100
-
难度 3/5 1-2 天 新手友好度 42/100
-
难度 4/5 3-5 天 新手友好度 25/100
-
难度 4/5 3-5 天 新手友好度 30/100
相似的 Issue
-
bug
难度 1/5 1 小时以内 新手友好度 60/100
-
Nmap
难度 1/5 1 小时以内 新手友好度 85/100
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 65/100
-
flang:fir-hlfir
难度 2/5 1-3 小时 新手友好度 70/100
llvm/llvm-project#225935 ·