What is the best way to capitalize the first character of a UTF8 string?
String#capitalize downcases the rest of the string which is unacceptable
since there can be capitals in the middle of the string. (“see New
York”.capitalize => “See new york”). Just picking off the first byte and
capitalizing that is also not an option since the first character can be
a multibyte UTF-8 character.
The only thing I can think of so far is either using Ruby 1.9 or the the
Rails multibyte Chars library to split off the first character and then
capitalize that and join it back together.
Surely there must be a better way for such a common problem?