开发者

Rails titlecase doesn't work on non-english letters

开发者 https://www.devze.com 2023-03-10 12:36 出处:网络
I\'m trying to use title开发者_开发百科case 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

I'm trying to use title开发者_开发百科case 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


This should work on unicode characters:

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

Results: Skjöldólfsstaði

0

精彩评论

暂无评论...
验证码 换一张
取 消