Is there a way to automatically encode urls?

I had the same problem encoding search queries from a data file doing requests in the request runner.

*** Data file ***
q”,
“你好”,

*** Pre request ***
let encoded = encodeURIComponent(data.q);
pm.environment.set(‘query’, encoded);

*** reqeuest URL ***
/api/v1/word/{{query}}

Hope this helps!