From: Martin Duerst Date: 2008-12-14T16:48:00+09:00 Subject: [ruby-core:20547] Re: encoding of symbols At 20:33 08/12/13, Charles Oliver Nutter wrote: >Yukihiro Matsumoto wrote: >> It was very easy to implement it, but when I tried, I found different >> inconsistency, which is: >> # encoding: utf-8 >> p :a.encoding # => # >> p :p.encoding # => # >> 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. > >Very good point; symbols are not necessarily created in the file where you use their literal form, and therefore need to have a single encoding everywhere. I concur. Please note that as far as I understand, ASCII-only symbols will be in and will therefore match across files with different non-ASCII encodings, but symbols including non_ascii characters will be in different encodings, and therefore won't match between files of different encodings. Regards, Martin. #-#-# Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University #-#-# http://www.sw.it.aoyama.ac.jp mailto:duerst@it.aoyama.ac.jp