Skip to content

encodeUtf8

将字符串编码为 UTF-8 格式。

用法

js
import { encodeUtf8 } from 'js-cool'

签名

typescript
function encodeUtf8(string: string): string

参数

参数类型描述
stringstring要编码的字符串

返回值

string - UTF-8 编码后的字符串。

示例

js
encodeUtf8('Hello') // 'Hello'
encodeUtf8('你好') // 编码后的字符串

相关

基于 MIT 许可发布