safeEncodeURIComponent
Encode a URI component safely, returning a percent-encoded string and avoiding exceptions on edge-case input during URL building.
Usage
safeEncodeURIComponent encodes a URI component safely.
import { safeEncodeURIComponent } from '@movk/core'
safeEncodeURIComponent('中文') // '%E4%B8%AD%E6%96%87'
safeEncodeURIComponent('hello world') // 'hello%20world'
API
safeEncodeURIComponent(str)
Encode a URI component (safe version).
Parameters
str
string required
The string to encode.
Returns
returns
string
The encoded string.
Changelog
No recent changes