How to use script to convert Hebrew text

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.

The Script

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?

  1. Open Terminal.
  2. 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.
    1. for file in ~/your-directory-path-here/*; do name=$ ...
  3. Paste the script in Terminal and press Enter.
  4. 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:

  1. Box
  2. STA Server (smb://

Whenever you’re finished with an individual course module, please do the following:

  1. Create new folder in Box with the name of the module you just did (name of the .SWF file on the spreadsheet)
  2. Add the converted .txt file and the images folder if applicable into that folder.
  3. Do the same but on the STA server.
  4. 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.

This entry was posted in Coding. Bookmark the permalink.

Comments are closed.