import { encode } from "https://deno.land/x/denops_std@v5.0.1/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:
import { encode } from "./utils.ts";
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.