Encode URI Component help

Hello guys.
i want to use " HTTP Request" node. it has some long text that should be encoded.
searched and found i have to use this : Webhook response header location ASCII Characters and UTF - #2 by MutedJam

{{ encodeURIComponent(“my text”) }}

but the problem is now, my text is output from other node and its gets error.
how to use this ? i got stuck and confused

thanks a lot.

Information on your n8n setup

  • n8n version: 0.206.1
  • Database you’re using (default: SQLite): default
  • Running n8n with the execution process [own(default), main]: default
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hey @rhodesgod,

Do you have an example workflow to share or maybe some input data and what you would expect it to be? The example workflow in the post you have linked to looks ok to me and should work so it could be that a slight tweak is needed to make it work in your workflow.

the first node output is some text.

which is this: hello. i am output.
{{ $ json [ " data " ] [ " children " ] [ 0 ] [ " data " ] [ " selftext " ] } }

so i have to put it in :
{{ encodeURIComponent(“my text”) }}

but it gets some syntax error.

{{ encodeURIComponent(“{ { $ json [ " data " ] [ " children " ] [ 0 ] [ " data " ] [ " selftext " ] } }”) }}

Can you try…

{{ encodeURIComponent( $json["data"]["children"][0]["data"]["selftext"]) }}

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.