const uri = "https://www.example.com/?x=サンプル値";
const encoded = encodeURI(uri);

console.log(encoded);
// 出力: "https://www.example.com/?x=%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E5%80%A4"
encodeURI(uri);
const uri = "https://example.com/search?query=Hello, world!&page=1";
const encodedUri = encodeURI(uri);

console.log(encodedUri);
// 出力: "https://example.com/search?query=Hello%2C%20world!&page=1"