Calculating Hebrew Holidays

hebcal is a nice utility that compiles on all major platforms and calculates the Hebrew holidays using a perpetual calendar.

iconv is an amazing piece of work that can convert between zillions of encoding formats and is also available for all major platforms.

By default, just running hebcal displays the current year’s Hebrew holidays in English. Adding the parameter -8 displays them as 8-bit Hebrew (ISO-8859-8-Logical), which was gibberish on my console. To display the Hebrew holidays in UTF-8 Hebrew I just did the following:

hebcal -8  | iconv -f ISO-8859-8 -t UTF-8

Works like a charm.

By the way, if you want to convert the encoding of a file (say cal.txt) using iconv but you have no idea what the current encoding is, from a linux console, just issue the following

file -i cal.txt

Note that for non-unix platforms where you don’t have the file command you can try and use chared or simply drag the file to your favorite Internet browser. If it is displayed correctly check what encoding was detected by the browser and if not, play around with the encodings until it does…

After you find the current encoding, you can then check if iconv supports it and the parameter iconv requires by issuing:

iconv -l

Leave a Reply

Your email address will not be published. Required fields are marked *