I have a problem with RegExp not recognizing special characters as word characters (or worse – counting as \b):
"wäww, xöxx yüyy zßzz".replace(/\b\w/g,function(m){return m.toUpperCase();})
should return
"Wäww, Xöxx Yüyy Zßzz"
but unfortunately returns:
"WäWw, XöXx YüYy ZßZz"
I played with several encodings but that didn’t help…
How can I make it recognize the characters or otherwise work around that problem?
There is a question with a similar problem with no satisfying answer.
Cheat
Instead of trying to work around the nuances of unicode and js, just use the space as the marker for your replace/caplitalize logic:
OR
OR
This kind of technique will correctly capitalize accented chars: