n8n-io / n8n

Free and source-available fair-code licensed workflow automation tool. Easily automate tasks across different services.
https://n8n.io
Other
46.33k stars 6.59k forks source link

Extract from text file corrupts non-UTF8 files #10950

Open dkarlovi opened 4 days ago

dkarlovi commented 4 days ago

Bug Description

If you're using the "Extract from text file" node to convert binary data into JSON, it will corrupt the data if it's not UTF8.

To Reproduce

  1. create a file, put S0FSTE9WScSGICA= after having base64-decoded it into it, this contains Karlović encoded using Windows-1250
  2. read it with Read file
  3. extract it with Extract from text file
  4. it gets corrupted

If I use this in the following code node without it, it works:

const body = iconv.decode(await this.helpers.getBinaryDataBuffer($itemIndex, 'file_0'), 'cp1250');

If I use the Extract node, it gets corrupted.

Expected behavior

Non-UTF8 encodings also work

Operating System

Docker image n8nio/n8n

n8n Version

1.59.3

Node.js Version

v20.17.0

Database

PostgreSQL

Execution mode

main (default)

Joffcom commented 4 days ago

Hey @dkarlovi,

We have created an internal ticket to look into this which we will be tracking as "GHC-251"