• Skip to main content
  • Skip to search
  • Skip to select language
MDN Web Docs
  • 参考手册
    • 概述 / Web 技术

      适用于开发者的 Web 技术参考手册

    • HTML

      Web 内容的结构

    • CSS

      用于描述文档样式的代码

    • JavaScript

      通用脚本语言

  • 开发指南
    • 概述 / MDN 学习区

      学习 Web 开发

    • MDN 学习区

      学习 Web 开发

    • HTML

      学习使用 HTML 构建 Web 内容

    • CSS

      学习使用 CSS 设置内容样式

    • JavaScript

      学习在浏览器中运行脚本

  • 更多中文网
  1. 面向开发者的 Web 技术
  2. 网络 API
  3. TextEncoder
  4. TextEncoder()

目录

  • Syntax
  • Specifications
  • Browser compatibility
  • See also
  1. Encoding API
  2. TextEncoder
  3. Constructor
    1. TextEncoder()
  4. Instance properties
    1. encoding
  5. Instance methods
    1. encode()
    2. encodeInto()
  6. Related pages for Encoding API
    1. TextDecoder
    2. TextDecoderStream
    3. TextEncoderStream

目录

  • Syntax
  • Specifications
  • Browser compatibility
  • See also

TextEncoder: TextEncoder() constructor

The TextEncoder() constructor returns a newly created TextEncoder object that will generate a byte stream with UTF-8 encoding.

Syntax

js
new TextEncoder()

Parameters

None.

Specifications

Specification
Encoding Standard
# ref-for-dom-textencoder①

Browser compatibility

BCD tables only load in the browser

See also

  • The TextEncoder interface it belongs to.
MDN Web 中文网 - 粤ICP备13048890号