From: Yukihiro Matsumoto Date: 2011-11-29T00:00:44+09:00 Subject: [ruby-core:41369] Re: Wrong encoding of Symbol Hi, In message "Re: [ruby-core:41362] Re: Wrong encoding of Symbol" on Mon, 28 Nov 2011 21:41:08 +0900, "NARUSE, Yui" writes: |> Matz wrote : |>> a = :foo |>> p a.encoding # => # (a) | |A symbol which consists of only US-ASCII characters is US-ASCII. | |>> b = "foo" |>> p b.encoding # => # (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 # => # (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 # => # (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.