
Issue #21450 has been updated by nobu (Nobuyoshi Nakada). Status changed from Open to Closed That difference is because of the difference of encodings. The string `"i"` is UTF-8, even it contains ASCII 7bit characters only, because the source encoding is defaulted to UTF-8. On the other hand, the encoding of a symbol, `:i`, that contains ASCII 7bit characters only is US-ASCII. ```ruby "i".encoding #=> #<Encoding:UTF-8> :i.encoding #=> #<Encoding:US-ASCII> ``` The string in US-ASCII does the same behavior as the symbol. ```ruby "i".encode("us-ascii").upcase(:turkic) #=> "I" ``` ---------------------------------------- Bug #21450: Inconsistent `upcase` between `String` and `Symbol` https://bugs.ruby-lang.org/issues/21450#change-113825 * Author: Stranger6667 (Dmitry Dygalo) * Status: Closed * ruby -v: 3.4 * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- Behavior for `Symbol#upcase` and `String#upcase` differs for `i` character if the `:turkic` option is present I'd expect `val.upcase(:turkic)` behaves consistently for both cases: ```ruby 'i'.upcase(:turkic) # "İ" with dot :i.upcase(:turkic) # :I no dot ``` However, when a non-ASCII character is present, then the case mapping on `Symbol` works the same way as with `String`: ```ruby :iФ.upcase(:turkic) # :İФ # with dot 'iФ'.upcase(:turkic) # "İФ" # with dot ``` -- https://bugs.ruby-lang.org/