Standalone solution:
# From : https://en.wikipedia.org/wiki/Cyrillic_alphabets :
upcase = ""
downcase = ""
headermonths = ["","","","","","","","","","",""]
headermonths.each{|word| word[0] = word[0].tr(downcase,upcase)}
# => ["", "", "", "", "", "", "", "", "", "", ""]
If you want to use it with words in Latin and Cyrillic alphabets:
headermonths.each{|word| word[0] = word[0].tr(downcase,upcase).upcase }
With ActiveSupport
You can use ActiveSupport :: Multibyte :
require 'active_support/core_ext/string/multibyte'
"".mb_chars.capitalize.to_s
So your script becomes:
require 'active_support/core_ext/string/multibyte'
headermonths = ["","","","","","","","","","",""]
headermonths.map!{|word| word.mb_chars.capitalize.to_s}
Ruby 2.4
The code in your question will work just as expected with Ruby 2.4.
. " Unicode" .