Convert encoding on variables on the fly in loop script?


New Member
Hi, I'm looking for something similar to:
sudo iconv -f ISO-8859-1 infile -t UTF-8 -o outfile.
but something equivalent for variables inside a bash script i Debian/Raspbian. I need something faster.

I need to minimize run time and file writing when my ( infinite while : ) script is:
* reading dozens of files, ISO-8859-1 encoded with accented characters in it.
These files are constantly updated with values updated every second by an external service (TFTP)
* The lines from each in-file are stored in variables before concatenated to a single multi line variable.
* The result is written to one new file UTF-8 encoded.
* A Java Script is polling this single file every second and showing it in an HTML table.
The HTML table (a status monitor) is updated every second must show the special characters now in UTF-8.

Is this possible? I haven't succeeded to skip converting and showing the table as ISO-8859-1 with the accented characters readable.
This is run in debian (raspbian) with apache2.


My first thought would be can you what ever is creating the files to make the conversion? I did a bit of googling if you can code in java you can try this out

So I guess what you are doing is technically possible.*my opinion) Nothing I have ever attempted before. Maybe someone else here has a more in depth idea on how to do what you are attempting
$100 Digital Ocean Credit
Get a free VM to test out Linux!