# HTTP Request Node and special characters

**URL:** https://discourse.nodered.org/t/http-request-node-and-special-characters/46506
**Category:** General
**Created:** [31 May 2021 12:07 UTC](https://discourse.nodered.org/t/http-request-node-and-special-characters/46506 "2021-05-31T12:07:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![TottiT](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@TottiT](https://discourse.nodered.org/u/TottiT)
#### Post date: [31 May 2021 12:07 UTC](https://discourse.nodered.org/t/http-request-node-and-special-characters/46506/1 "2021-05-31T12:07:48Z")

</div>

Hey all!

A rather fresh (~1 year on/off) node-red user here! I'm having trouble parsing a webpage which includes Scandinavian letters like ä/ö.

Here's an example flow:

```auto
[{"id":"a02852a0.3a07","type":"tab","label":"Encoding Tests","disabled":false,"info":""},{"id":"ba38d1f4.0b2","type":"debug","z":"a02852a0.3a07","name":"Parsed","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":900,"y":240,"wires":[]},{"id":"3d216b95.a0462c","type":"http request","z":"a02852a0.3a07","name":"","method":"GET","ret":"bin","paytoqs":false,"url":"{{{payload}}}","tls":"","persist":false,"proxy":"","authType":"","x":530,"y":240,"wires":[["44e88e2.6e44ef"]]},{"id":"44e88e2.6e44ef","type":"html","z":"a02852a0.3a07","name":"get element","property":"payload","outproperty":"payload","tag":".tori_title","ret":"html","as":"single","x":730,"y":240,"wires":[["ba38d1f4.0b2"]]},{"id":"2bac3368.a6e15c","type":"inject","z":"a02852a0.3a07","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":240,"wires":[["d9494d1.7e55d3"]]},{"id":"d9494d1.7e55d3","type":"function","z":"a02852a0.3a07","name":"URL","func":"msg.payload = \"https://muusikoiden.net/tori/ilmoitus/1649213\"\n\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":240,"wires":[["3d216b95.a0462c"]]},{"id":"54040bdd.f1a7a4","type":"debug","z":"a02852a0.3a07","name":"Example","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":900,"y":80,"wires":[]},{"id":"d3a70029.6e347","type":"inject","z":"a02852a0.3a07","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":80,"wires":[["ac69c829.ec2388"]]},{"id":"ac69c829.ec2388","type":"function","z":"a02852a0.3a07","name":"Generate \"wanted\" response","func":"msg.payload = [\"<b>Myydään:</b> Doepfer Dark Energy II\"]\n\nreturn msg;","outputs":1,"noerr":0,"x":540,"y":80,"wires":[["54040bdd.f1a7a4"]]},{"id":"47282f0f.c3322","type":"comment","z":"a02852a0.3a07","name":"Should be like this!","info":"","x":530,"y":40,"wires":[]},{"id":"a980b970.cebc2","type":"function","z":"a02852a0.3a07","name":"Encoding","func":"msg.payload = msg.payload.toString('iso-8859-15')\n\nreturn msg;","outputs":1,"noerr":0,"x":720,"y":340,"wires":[[]]},{"id":"2f26623b.167b7e","type":"comment","z":"a02852a0.3a07","name":"Tried out encoding, didn't work","info":"","x":720,"y":300,"wires":[]},{"id":"19bf0ef.76b9c71","type":"comment","z":"a02852a0.3a07","name":"But gives out this..","info":"","x":530,"y":200,"wires":[]}]

```

In short, I'm trying to read some elements from a webpage using a combination of the _HTTP Request_, as well as the _HTML parser_ nodes. At the moment, I'm able to get the right elements with the _HTML parser_, but some of characters don't display properly at the debug-window. I added an alternative branch to the flow to show how they should look like, and also to confirm that, at least in my node-red instance, the debugger should be able to display the letters correctly.

I'm always a little confused with this encoding and decoding stuff, so I figured that instead of banging my head against the wall by myself, maybe some of you kind folks at the forum could guide me!

Thanks a lot for your time!

---

<div class="post-metadata">

### Author: ![TottiT](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@TottiT](https://discourse.nodered.org/u/TottiT)
#### Post date: [6 June 2021 10:50 UTC](https://discourse.nodered.org/t/http-request-node-and-special-characters/46506/2 "2021-06-06T10:50:18Z")

</div>

Hey all!

I'm bumping this topic since I'm still struggling with the issue.

My flow is currently otherwise finished, I have the backend doing what it's supposed to do, and I'm getting notified by the things I'd like to. The only problem is the aesthetics of the resulting HTML page that carries the notifications. All the scandinavian literals translate as question marks, which doesn't really make the outsome so pretty.

If anyone can point me to the right direction with this, any help is appreciated!

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [6 June 2021 11:12 UTC](https://discourse.nodered.org/t/http-request-node-and-special-characters/46506/3 "2021-06-06T11:12:11Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/b/0b061d0c4c18a241a4b90d22ad0d3914b98fb588.png)

```auto
[{"id":"ba38d1f4.0b2","type":"debug","z":"a02852a0.3a07","name":"Parsed","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1780,"y":240,"wires":[]},{"id":"3d216b95.a0462c","type":"http request","z":"a02852a0.3a07","name":"","method":"GET","ret":"bin","paytoqs":"ignore","url":"{{{payload}}}","tls":"","persist":false,"proxy":"","authType":"","x":1770,"y":160,"wires":[["a980b970.cebc2"]]},{"id":"44e88e2.6e44ef","type":"html","z":"a02852a0.3a07","name":"get element","property":"payload","outproperty":"payload","tag":".tori_title","ret":"text","as":"multi","x":1610,"y":240,"wires":[["ba38d1f4.0b2"]]},{"id":"2bac3368.a6e15c","type":"inject","z":"a02852a0.3a07","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1440,"y":160,"wires":[["d9494d1.7e55d3"]]},{"id":"d9494d1.7e55d3","type":"function","z":"a02852a0.3a07","name":"URL","func":"msg.payload = \"https://muusikoiden.net/tori/ilmoitus/1649213\"\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1590,"y":160,"wires":[["3d216b95.a0462c"]]},{"id":"a980b970.cebc2","type":"function","z":"a02852a0.3a07","name":"Encoding","func":"\nmsg.payload = msg.payload.toString(\"latin1\")\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1420,"y":240,"wires":[["44e88e2.6e44ef"]]}]

```

---

<div class="post-metadata">

### Author: ![TottiT](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@TottiT](https://discourse.nodered.org/u/TottiT)
#### Post date: [7 June 2021 09:19 UTC](https://discourse.nodered.org/t/http-request-node-and-special-characters/46506/4 "2021-06-07T09:19:10Z")

</div>

Aah, thanks a lot @Steve-Mcl! That did it! Seems I was very close already.

Judging from your flow example, it seems it's also important not to return the HTML-contents of the elements with the _HTML parser_ node (but rather the text contents) if you want to have properly rendered text in the debugger node. I think I might have tried the latin1-encoding within the encoding-function at some point, but since I was returning the HTML-contents, the debugger-node didn't render the results properly. Like said, this encoding/decoding business is still somewhat confusing for me..

Anyways, thanks a lot your time and help!! I added the encoding to the bigger flow, and everything displays as it should in the HTML output! Woohoo!

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [7 June 2021 09:20 UTC](https://discourse.nodered.org/t/http-request-node-and-special-characters/46506/5 "2021-06-07T09:20:21Z")

</div>

> [@TottiT](#):
>
> thanks a lot your time and help!! I added the encoding to the bigger flow, and everything displays as it should in the HTML output! Woohoo!

You're welcome.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [21 June 2021 09:20 UTC](https://discourse.nodered.org/t/http-request-node-and-special-characters/46506/6 "2021-06-21T09:20:55Z")

</div>

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