Hi,
In message "Re: [ruby-core:20494] Re: encoding of symbols"
on Fri, 12 Dec 2008 08:45:03 +0900, Yukihiro Matsumoto <matz / ruby-lang.org> writes:
||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?
|
|You are right about encoding of the symbols. I will fix, unless there's
|any reason I forget right now.
It was very easy to implement it, but when I tried, I found different
inconsistency, which is:
# encoding: utf-8
p :a.encoding # => #<Encoding:UTF-8>
p :p.encoding # => #<Encoding:US-ASCII>
means a symbol would have an encoding of which the symbol first
appears, in this case symbol :a first appears on a file with UTF-8
encoding, whereas :p appears first for a name to built-in method.
So rather making symbols to have somewhat unpredictable encoding, I'd
rather keep them as they are now, despite the inconsistency with
string encoding.
matz.