[#69616] [Ruby trunk - Feature #11258] add 'x' mode character for O_EXCL — cremno@...
Issue #11258 has been updated by cremno phobia.
3 messages
2015/06/16
[#69643] [Ruby trunk - Misc #11276] [RFC] compile.c: convert to use ccan/list — normalperson@...
Issue #11276 has been updated by Eric Wong.
3 messages
2015/06/17
[#69751] [Ruby trunk - Bug #11001] 2.2.1 Segmentation fault in reserve_stack() function. — kubo@...
Issue #11001 has been updated by Takehiro Kubo.
3 messages
2015/06/27
[ruby-core:69503] [Ruby trunk - Feature #10900] GzipReader does not define `#external_encoding`
From:
akostadinov@...
Date:
2015-06-09 08:33:11 UTC
List:
ruby-core #69503
Issue #10900 has been updated by Aleksandar Kostadinov.
Daniel Berger wrote:
> I'd say it should add #encoding and #internal_encoding methods as well, since the constructor supports those options.
I guess you have to file a separate feature request for that.
----------------------------------------
Feature #10900: GzipReader does not define `#external_encoding`
https://bugs.ruby-lang.org/issues/10900#change-52806
* Author: Aleksandar Kostadinov
* Status: Closed
* Priority: Normal
* Assignee:
----------------------------------------
Hello,
I want to store/load some **yaml** and other text data in gz for space efficiency. I thought it's most efficient to read/write directly to/from a gzip stream. But seems like the **GzipReader** io object does not support everything that a regular file io object does. I spotted the **#external_encoding** method. So for example to load YAML directly from gzip I use the following method:
~~~
def load_yaml_from_gz(gz)
loaded = nil
Zlib::GzipReader.open(gz) do |f|
class << f
def external_encoding
Encoding::UTF_8
end
end
loaded = YAML.load(f, gz)
end
return loaded
end
~~~
I need the monkey-patching because otherwise the YAML.load method fails for no **#external_encoding** method defined.
To avoid monkey patching just to read some text from a gzip archive I propose that GzipReader implements **#external_encoding** the same way as **File** does.
--
https://bugs.ruby-lang.org/