Dave Thomas wrote:
> 
> On Jan 10, 2008, at 10:55 PM, Yukihiro Matsumoto wrote:
> 
>> I don't think there's no string in Ruby without encoding.  Every
>> string has their own encoding.  Allowing nil is pretty easy, but if it
>> encourage the false conception (like you had), it might be better to
>> remove it from long range view.  Let me think.
> 
> 
> I'm certainly not an expert on encoding, so take this with a grain of 
> salt, but it seems to be that there _is_ a different between a string 
> tagged ASCII-8BIT and a string with no encoding. A string with no 
> encoding should remain unchanged under operations such as #upcase, 
> whereas upcase on an ASCII-8BIT string could return a string with 
> different content.

Yes, but keep in mind that Encoding::BINARY is a synonym for 
Encoding::ASCII_8BIT. I just think that nil should work like "no 
encoding". The closest we've got right now is Encoding::BINARY.

> Or, looking at it another way, a string with no encoding contains bytes 
> but no characters.

Exactly.  And when you want to deal with bytes the best you can do is to 
use Encoding::BINARY

> Of course, if that's the interpretation, then 
> "cat".force_encoding(nil)[0] should throw an exception, so maybe that's 
> too big a change... :)
> 

I don't follow you on this.

> Dave

	David