Skip to content

encodeUtf8

Encode a string to UTF-8 format.

Usage

js
import { encodeUtf8 } from 'js-cool'

Signature

typescript
function encodeUtf8(string: string): string

Parameters

ParameterTypeDescription
stringstringThe string to encode

Returns

string - The UTF-8 encoded string.

Examples

js
encodeUtf8('Hello') // 'Hello'
encodeUtf8('你好') // Encoded string

Released under the MIT License.