From: Dave Thomas Date: 2008-12-12T03:34:38+09:00 Subject: [ruby-core:20486] Re: encoding of symbols On Dec 11, 2008, at 11:38 AM, Charles Oliver Nutter wrote: >> I was surprised to see that a has US-ASCII encoding. Now that >> strings and symbols are converging, shouldn't both a and b be >> encoded UTF-8, so that symbols and strings behave the same way? > > Strings and symbols are converging? :cat[2] => "t" So the interpreter implies that symbols have a string representation (as opposed, for example, to an object id representation, in which case an aref would return a bit, as it does for fixnums). And if indexing into a symbol returns a string, then I'd expect the same encoding rules to apply to the symbol as to the string. Right now, we have the strange situation that "cat".to_sym.to_s.encoding != "cat".encoding Dave