# Reading File - Odd character return output?

**URL:** <https://discourse.nodered.org/t/reading-file-odd-character-return-output/78130>\
**Category:** General\
**Created:** [2 May 2023 21:15 UTC](https://discourse.nodered.org/t/reading-file-odd-character-return-output/78130 "2023-05-02T21:15:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aidanvenn](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@aidanvenn](https://discourse.nodered.org/u/aidanvenn)\
**Post date:** [2 May 2023 21:15 UTC](https://discourse.nodered.org/t/reading-file-odd-character-return-output/78130/1 "2023-05-02T21:15:21Z")

</div>

Hi,

Pic below hopefully helps.

 ![node red issue](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/e/9ea4829018b4f7c8a3100a19154208503e5a5668.png)

When I read a simple text file it reads each line but appears to add a character return for all expect the last line(which has no return). This causes issues processing the output in next steps as the value isn`t as expected. For example:

"XXXXXXXXXX"

is actually

"XXXXXXXXXX  
"

Text file created in notepad++ on windows 11.

I`ve noticed that when I select text in notepad++ it highlights a space at the end of each line except the last. Pic:  
 ![node red issue pic2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/f/ef4451ffd52779949b5da7ce4f011b40c9ca5a70.png)

Maybe encoding of file? Tried utf-8 but not luck.

Any ideas?

Thank you

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [3 May 2023 01:22 UTC](https://discourse.nodered.org/t/reading-file-odd-character-return-output/78130/2 "2023-05-03T01:22:45Z")

</div>

Humm I couldn't replicate this using notepad as the source, regardless of encoding?

In notepad++ if you select view then show symbol then show all it might give you a clue.

Alternatively there is a handy node to remove white space and many other options.

> **[node-red-contrib-string](https://flows.nodered.org/node/node-red-contrib-string)**
>
> Provides a string manipulation node with a chainable UI based on the concise and lightweight stringjs.com.

---

<div class="post-metadata">

**Author:** ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)\
**Post date:** [3 May 2023 05:53 UTC](https://discourse.nodered.org/t/reading-file-odd-character-return-output/78130/3 "2023-05-03T05:53:02Z")

</div>

> [@aidanvenn](#):
>
> Any ideas?

As you're on Windows, I'm guessing you're going with the standard Notepad++ & Windows setting: NewLine there is `CR LF` (2 characters,`\r\n`) - as stated in the footer line of NP++:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/2/528e376fa9bfecda81dd9a5cad921f8ac26dd35f.png)

The FileIn-Node splits the incoming stream yet Linux/Unix-like @ `\n`:

> <https://github.com/node-red/node-red/blob/67dd7e30faf1a6fca07f5b745de75f4ad3036ce4/packages/node_modules/%40node-red/nodes/core/storage/10-file.js#L352>

What you see could be the leftover `\r` portion of the Windows-like NewLine sequence.

Possible solution: Change the format of the file created by NP++ to `UNIX (LF)` ... by e.g. right-clicking on the field in the footer & appropriate selection ... or propose a PR to extend the capabilities of the FileIn-Node, allowing to select the LineSplit character sequence.

---

<div class="post-metadata">

**Author:** ![aidanvenn](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@aidanvenn](https://discourse.nodered.org/u/aidanvenn)\
**Post date:** [3 May 2023 09:31 UTC](https://discourse.nodered.org/t/reading-file-odd-character-return-output/78130/4 "2023-05-03T09:31:46Z")

</div>

@Sean-McG Did the trick - Thank you

@ralphwetzel - Thank you

---

<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:** [17 May 2023 09:32 UTC](https://discourse.nodered.org/t/reading-file-odd-character-return-output/78130/5 "2023-05-17T09:32:25Z")

</div>

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