JavaScript String toWellFormed()
Description
The toWellFormed() method returns returns a new string where all
"lone surrogates" are replaced with the Unicode replacement character (U+FFFD).
The toWellFormed() method does not change the orgininal string.
Lone Surrogates
A Lone surrogate is a Unicode surrogate code that is not a part of a valid surrogate pair, used to represent characters in UTF-16 encoding.
Syntax
string.toWellFormed()
Parameters
| NONE |
Return Value
| Type | Description |
| String | A string where all "lone surrogates" are replaced with the Unicode replacement character (U+FFFD). |
Browser Support
toWellFormed() is a JavaScrip 2024 feature.
ES 2024 is fully supported in all modern browsers since March 2024:
| Chrome 117 |
Edge 117 |
Firefox 119 |
Safari 17.4 |
Opera 103 |
| Sep 2023 | Sep 2023 | Oct 2023 | Okt 2024 | May 2023 |