diff --git a/javascript/atoms/dom.js b/javascript/atoms/dom.js index 68dbdacc163ee..3e683184e94f1 100644 --- a/javascript/atoms/dom.js +++ b/javascript/atoms/dom.js @@ -1175,7 +1175,7 @@ bot.dom.appendVisibleTextLinesFromTextNode_ = function(textNode, lines, } if (textTransform == 'capitalize') { - text = text.replace(/(^|\s|\b)(\S)/g, function() { + text = text.replace(/(^|[^\d\p{L}\p{S}])([\p{Ll}|\p{S}])/gu, function() { return arguments[1] + arguments[2].toUpperCase(); }); } else if (textTransform == 'uppercase') { diff --git a/javascript/atoms/test/text_test.html b/javascript/atoms/test/text_test.html index 4698ac5db46db..5dc0d1ccbaa4e 100644 --- a/javascript/atoms/test/text_test.html +++ b/javascript/atoms/test/text_test.html @@ -18,6 +18,7 @@ text_test.html +