The Joomla .ini files require to be saved as UTF-8.
After editing I'm not sure if the files are UTF-8 or not.
Is there a Linux command like file or a few commands that would tell if a file is indeed UTF-8 or not?
The Joomla .ini files require to be saved as UTF-8.
After editing I'm not sure if the files are UTF-8 or not.
Is there a Linux command like file or a few commands that would tell if a file is indeed UTF-8 or not?
There is, use the isutf8 command from the moreutils package.
Source: How can you tell if a file is UTF-8 encoded or not?
Do not use the file command. It does not inspect the whole file, and it basically guesses. It sometimes gives incorrect answers.
You can verify if a file happens to pass UTF-8 encoding like this:
$ iconv -f utf8 <filename> -t utf8 -o /dev/null
A return code of zero means it passes UTF8. A non-zero return code means it is not valid UTF8.
It is not possible to know if a file was necessarily exported using any particular encoding scheme, as some encoding schemes overlap. To do that would require metadata to be embedded in the file, and even then you would be placing trust in whoever generated that file, rather than validating it yourself... and you should always validate it yourself.
You can use the TextIntegrityInspector package to validate the integrity of your Joomla .ini files as UTF-8. Here's how you can do it:
Install TextIntegrityInspector:
pip install textIntegrityInspector
Use TextIntegrityInspector to validate files in the command line:
textIntegrityInspector path_to_your_ini_files --extensions ini
This will check all .ini files in the specified directory to ensure they are valid UTF-8.
Alternatively, use TextIntegrityInspector in a docker env:
docker run -it -v path_to_your_ini_files :/data text_integrity_inspector --extensions ini
You can add --language="fr" option to indicate only French characters are accepted ,