import { encode } from "https://deno.land/x/denops_std@v3.11.2/bufname/utils.ts";
Encode only unusable characters to percent-encoded characters.
This function does not encode the percent character itself to avoid multiple encoding. Users must encode the percent character themselves before using this function like:
const expr = "%Hello world%";
const encoded = encode(expr.replaceAll("%", "%25"));
Note that this function is not the inverse of decode
.
The decode
function decodes all percent-encoded characters, while this function
encodes a few characters.