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:

$ egrep -n "= rb_ascii8bit" io.c
232:#define NEED_WRITECONV(fptr) ((fptr->encs.enc != NULL && 
fptr->encs.enc != rb_ascii8bit_encoding()) || 
NEED_NEWLINE_DECORATOR_ON_WRITE(fptr) || (fptr->encs.ecflags & 
(ECONV_DECORATOR_MASK|ECONV_STATEFUL_DECORATOR_MASK)))
774:        if (!fptr->encs.enc || (fptr->encs.enc == 
rb_ascii8bit_encoding() && !fptr->encs.enc2)) {
924:            else if (fptr->encs.enc != rb_ascii8bit_encoding())
3948:    fptr->encs.enc = rb_ascii8bit_encoding();
4203:    if (intern == NULL && ext != rb_ascii8bit_encoding())

-- 
Posted via http://www.ruby-forum.com/.