5

ucwords doesn't capitalize foreign chars like öüäõ

so I need a solution, which will make "öösel" into "Öösel"

Is there a simple way to do it with regexp or I have to check all the characters manually?

Hannes
  • 55
  • 1
  • 3

3 Answers3

9

If you have the mbstring extension installed, you can use the mb_convert_case function, specifying MB_CASE_TITLE as the $mode parameter.

rink.attendant.6
  • 44,500
  • 61
  • 101
  • 156
Dean Harding
  • 71,468
  • 13
  • 145
  • 180
4

You can give a try to strtoupper() which works fine for me with French.
Sorry I hadn't seen it was ucwords...

Otherwise, this should work:

mb_convert_case($string, MB_CASE_TITLE, "UTF-8");

Nabab
  • 2,608
  • 1
  • 19
  • 32
0

Aside from the other answers, which suffer from the same problems as ucwords, you might take a look at keeping this variation in your toolbox.

SilverbackNet
  • 2,076
  • 17
  • 29