I am not able to change the file encoding of files on my ubuntu server (version: Ubuntu 18.04.5 LTS) that has XAMPP installed and is on an AWS EC2 instance. I'm logged in as root and can edit, change and delete files. I'm logged in as root and the owner of the files is root.
I tried different versions of iconv:
iconv -f US-ASCII index.php -t ISO-8859-1 > indexisoiso.php
iconv -f utf-8 -t iso-8859-1 index.php
iconv -c -f US-ASCII -t ISO-8859-1 index.php > indexindex2.php
New files are created & no errors are shown, however, when I check file encoding again ("file --mime-encoding index.php" or "chardet index.php"), it's back to US-ASCII.
I also tried to change the encoding in vim, which didn't work:
:write ++enc=iso-8859-1 index.php
I connected to my EC2 via SSH in Visual Studio. I can (after giving myself permissions) change the file encoding there and save the file. However, when I close and reopen the file, it's back to US-ASCII (actually, in VS code, it shows "UTF-8". From what I read "UTF-8" & "US-ASCII" are equal for my purposes).
Would anyone know why I can't change the encoding of files on my ubuntu server? Has anyone had similar problems?