From: Robert Klemme Date: 2011-09-13T06:58:30+09:00 Subject: Re: how to write data in binary to a file? On Mon, Sep 12, 2011 at 7:45 PM, Brian Candler wrote: > Robert Klemme wrote in post #1021429: >> irb(main):002:0> u.names >> => ["ASCII-8BIT", "BINARY"] >> >> In other words: binary and ASCII-8BIT are the same. > > Indeed. > >> I find the behavior totally consistent > > Consistent with what? If you set external_encoding to something other > than nil, you are telling ruby to transcode strings on output to the > given encoding - *unless* the given encoding is "ASCII-8BIT"/"BINARY". > > So it seems that "ASCII-8BIT" is handled as a special case. In fact, > looking at io.c, that encoding is handled as a special case all over the > place: The only special thing is that it is the "encoding" of a String's raw data, I'd say. Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/