Okay, I played around with this, and it is way over my head, but I think I got you started :-). This assumes you are using a Mac and or have BASH or ZSH installed on your Windows or Linux machine.
Create a temporary folder and copy your html files over to it (I do not want to be responsible if something goes wrong).
Open a terminal window (zsh or bash will run) and type the following (rename
filename.html to some random file you created:
file -I filename.html
You will see the output. I bet it says
ASCII, but if it does not, then make a note of the file type.
If it is NOT ASCII, type the following command:
iconv --list or
Pick the file format that matches what you want to convert from. Note that the file types listed might have spaces next to them. For example, it might see
HP-ROMAN8 R8 ROMAN8 CSHPROMAN8. Just pick one of those as they are all the same, meaning I believe
R8 is the same thing as
Using a code edit, create a new file in that new folder and call it
convert.sh with the following code:
# convert file to UTF-8
for file in *.html; do
echo "Working on file: $file"
iconv -f "ASCII" -t "UTF-8" "$file" > "$newfile"
echo "Output to new file: $newfile"
file -I $newfile
As mentioned, if your input file type does not just say “ASCII”, then replace it with the closest match file from the
iconv list you got earlier.
Also, if your files have a different extension, like
[filename].markdown, then replace any instance of
While in the terminal window, go to the folder where your copied files are located.
For example, if you are on macOS and the files are on your desktop in a
convert folder, you type this:
ls to make sure you see all the converted files.
Now you are going to run the
convert.sh file you created. Try one and if the other throws an error, try the other:
You should see the code process all the files, and now you will have a whole bunch of new
.utf8.html files (or
.markdown or whatever).
In your Jekyll site, temporarily remove all those converted files and put them somewhere else. Copy over the newly converted utf8 files and see if Jekyll builds.
I hope this helps. This was something new to learn, so hopefully, I did not send you down the wrong path.