This tutorial will cover how to run a bash script that will convert all .txt files in a directory from broken Hebrew text to readable Hebrew text.
We assume that you’ve already extracted the text and images from the SWF file and saved it on your Desktop as demonstrated here.
for file in ~/Desktop/texts/*; do name=$(echo "$file" | cut -f 1 -d '.'); iconv --from-code UTF8 --to-code ISO-8859-1 "$file" | iconv --from-code ISO-8859-8 --to-code UTF8 > "$name-converted.txt"; done
I won’t go into the nitty-gritty of how everything in the command works, but basically, it iterates over every file inside the /Desktop/texts directory, converts it to readable UTF8 encoding, and then outputs the result to a new file with -converted appended to the original filename.
How do I run it?
- Open Terminal.
- If you’ve saved your exported texts and images directories somewhere other than ~/Desktop, feel free to change the beginning part of the script to wherever your saved directories are.
for file in ~/your-directory-path-here/*; do name=$ ...
- Paste the script in Terminal and press Enter.
- That’s it! Now, check inside your directory and you should see new .txt files created with -converted appended to the end of the file name. Open them and make sure they contain the correct Hebrew text.
For the Hebrew Flash Remediation project
We’re going to be saving our results in two directories:
- STA Server (smb://file.laits.utexas.edu/sta/_LAITS_projects/hebrew/flash-remediation)
Whenever you’re finished with an individual course module, please do the following:
- Create new folder in Box with the name of the module you just did (name of the .SWF file on the spreadsheet)
- Add the converted .txt file and the images folder if applicable into that folder.
- Do the same but on the STA server.
- Mark on the spreadsheet that you’ve saved the results in both Box and the STA server.
We want to save on both and keep them in sync incase Box goes down.