Hi,

In message "Re: [ruby-core:41362] Re: Wrong encoding of Symbol"
    on Mon, 28 Nov 2011 21:41:08 +0900, "NARUSE, Yui" <naruse / airemix.jp> writes:

|> Matz wrote : 
|>> a = :foo
|>> p a.encoding      # => #<Encoding:US-ASCII>  (a)
|
|A symbol which consists of only US-ASCII characters is US-ASCII.
|
|>> b = "foo"
|>> p b.encoding      # => #<Encoding:UTF-8>     (b)
|
|Of course, it is UTF-8.

Considering the fact that a string which consists of only US-ASCII
characters is UTF-8, a symbol which consists of only US-ASCII being
US-ASCII is bit awkward for me.

|>> c = "#{a}foo"
|>> p c.encoding	  # => #<Encoding:US-ASCII>  (c)
|
|(str + another)'s encoding will be str's encoding when both str and
|another consist of only ASCII characters.
|
|>> d = "foo#{a}"
|>> p d.encoding      # => #<Encoding:UTF-8>     (d)
|
|So this is "foo"'s encoding.

I understand the internal.  I know why the encoding of the symbol is
US-ASCII.  But having above awkwardness, this issue still makes me
feel inconsistent.  A string which consists of only US-ASCII
characters should be UTF-8, even when a US-ASCII symbol is embedded at
the top of the string.

							matz.