gugguson
gugguson

Reputation: 819

Rails titlecase doesn't work on non-english letters

I'm trying to use titlecase to change an all uppercase words to nicer output. It works with non english letters but not on other letters. Is there any similar more UTF-8 friendly command?

"#{self.name.titlecase}"

Results:  SkjÖldÓlfsstaÐi

Johann

Upvotes: 1

Views: 156

Answers (1)

Viktor
Viktor

Reputation: 3080

This should work on unicode characters:

"SkjÖldÓlfsstaÐi".mb_chars.titlecase.to_s

Results: Skjöldólfsstaði

Upvotes: 2

Related Questions