USVString - Web APIs 编辑

USVString is a sequence of Unicode scalar values. This definition differs from that of DOMString or the JavaScript String type in that it always represents a valid sequence suitable for text processing, while the latter can contain surrogate code points. The USVString type is generally found in APIs that perform text processing, while DOMString is used by most other APIs.

When a USVString is provided to JavaScript, it maps to the JavaScript primitive String with the UTF-16 encoding of its sequence of Unicode scalar values.

When a Web API accepts a USVString, the JavaScript value provided is first stringified, in the same way as for DOMString. The resulting string is then further converted to USVString by replacing any surrogate code points (or equivalently, any unpaired surrogate code units) with the Unicode "replacement character" U+FFFD (�).

Specifications

SpecificationStatusComment
Web IDL
The definition of 'USVString' in that specification.
Candidate RecommendationInitial definition of the USVString type itself.
Web IDLCandidate RecommendationThis defines how JavaScript values are converted to USVString and vice versa.

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:131 次

字数:2773

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文