# Http request with windows-1250 encoding problem

**URL:** https://discourse.nodered.org/t/http-request-with-windows-1250-encoding-problem/61411
**Category:** General
**Tags:** http-request
**Created:** [17 April 2022 19:48 UTC](https://discourse.nodered.org/t/http-request-with-windows-1250-encoding-problem/61411 "2022-04-17T19:48:45Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jelinek](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jelinek](https://discourse.nodered.org/u/jelinek)
#### Post date: [17 April 2022 19:48 UTC](https://discourse.nodered.org/t/http-request-with-windows-1250-encoding-problem/61411/1 "2022-04-17T19:48:45Z")

</div>

I am having troubles loading HTTP request when the page is in windows-1250 encoding. The http request component parses the input into UTF-8 incorrectly and that seems to be irreversible. Any output after that is basically gibberish instead of accented characters. I am not sure how to prevent it from parsing it into UTF-8 or specifying the input encoding so it would be parsed correctly. I could probably load the input into file with some external tool and work with the file but I would prefer to use the http request component.

There must be something I am missing otherwise lots of websites would be unreadable, right?

```auto
[{"id":"613da0f5dc72ceef","type":"debug","z":"a2875b641ea93857","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":890,"y":400,"wires":[]},{"id":"dfbc815d2b09e165","type":"inject","z":"a2875b641ea93857","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":340,"y":400,"wires":[["253669a404640f8b"]]},{"id":"253669a404640f8b","type":"http request","z":"a2875b641ea93857","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://www.menicka.cz/mobilni/praha-8.html","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":510,"y":400,"wires":[["685d722826f55028"]]},{"id":"685d722826f55028","type":"html","z":"a2875b641ea93857","name":"html","property":"payload","outproperty":"payload","tag":"#up > div.vypis_menicek > div.menicka_detail > div.menicka","ret":"text","as":"single","x":690,"y":400,"wires":[["613da0f5dc72ceef"]]}]

```

---

<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: [17 April 2022 19:52 UTC](https://discourse.nodered.org/t/http-request-with-windows-1250-encoding-problem/61411/2 "2022-04-17T19:52:45Z")

</div>

Have you tried setting headers to specify the encoding? Have you tried setting the HTTP request to return a buffer then feed it I to an iconv node? Did you search the forum - for example: [Read windows-1250 encoded data - #4 by TotallyInformation](https://discourse.nodered.org/t/read-windows-1250-encoded-data/25265/4)

---

<div class="post-metadata">

### Author: ![jelinek](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jelinek](https://discourse.nodered.org/u/jelinek)
#### Post date: [17 April 2022 20:22 UTC](https://discourse.nodered.org/t/http-request-with-windows-1250-encoding-problem/61411/4 "2022-04-17T20:22:21Z")

</div>

Hi. Thx for quick reply. FYI its my first day wirh node red.

Setting encoding: yes I have tried that. I setup a function which returns msg variable with msg.headers 'Accept-Encoding' header and fed it into http request node but it didn't help.

Searching the forum: yes I read all posts which talk about encoding. The one you are posting is one of the closest to the solution but it is not helpful for http requeat node.

Buffer: yeah I was thinking about streams, which I guess are called buffers here but as I mentioned it is my first day and I am not sure how buffers work here. The node tool so far looks amazing but for learning it is bit abstract for me so far. I don't exactly know what the nodes are doing internally. Buffers looks like only way to go. Going to investigate. I suppose I just do the http request with output into buffer, parse it through the iconv node and after use some kind of parser node for html or whatever format I need, right?

---

<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: [18 April 2022 07:44 UTC](https://discourse.nodered.org/t/http-request-with-windows-1250-encoding-problem/61411/5 "2022-04-18T07:44:42Z")

</div>

> [@jelinek](#):
>
> Buffer: yeah I was thinking about streams, which I guess are called buffers here but as I mentioned it is my first day and I am not sure how buffers work here

Buffers are similar to byte array with helper functions - provided by the nodejs framework. [See the Docs](https://nodejs.org/en/knowledge/advanced/buffers/how-to-use-buffers/)

> [@jelinek](#):
>
> I suppose I just do the http request with output into buffer, parse it through the iconv node

Yes, that should get you usable data.

> [@jelinek](#):
>
> The node tool so far looks amazing but for learning it is bit abstract for me so far

I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

---

<div class="post-metadata">

### Author: ![jelinek](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jelinek](https://discourse.nodered.org/u/jelinek)
#### Post date: [18 April 2022 12:37 UTC](https://discourse.nodered.org/t/http-request-with-windows-1250-encoding-problem/61411/6 "2022-04-18T12:37:22Z")

</div>

It works! Just use the binary output of the _http-request_ node and pass the output to the _converter_ node ([node-red-contrib-iconv (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-iconv)) with encoding set to windows-1250 (source webpage encoding) and it will get displayed correctly.

```auto
[{"id":"36193ce86ca865ca","type":"debug","z":"b65eba7d5d414a94","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":890,"y":860,"wires":[]},{"id":"c35b554dd338f807","type":"inject","z":"b65eba7d5d414a94","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":860,"wires":[["f53db24882819fe6"]]},{"id":"f53db24882819fe6","type":"http request","z":"b65eba7d5d414a94","name":"","method":"GET","ret":"bin","paytoqs":"ignore","url":"https://www.menicka.cz","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":350,"y":860,"wires":[["560b7612633a3853"]]},{"id":"560b7612633a3853","type":"converter","z":"b65eba7d5d414a94","name":"","from":"windows-1250","x":520,"y":860,"wires":[["36193ce86ca865ca"]]}]

```

---

<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: [2 May 2022 12:38 UTC](https://discourse.nodered.org/t/http-request-with-windows-1250-encoding-problem/61411/7 "2022-05-02T12:38:01Z")

</div>

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