iconv("ISO-8859-8", "UTF-8", hebrev(iconv("UTF-8", "ISO-8859-8", $s)));
solves the reversed hebrew problem, by using hebrev to preflip the hebrew strings.
The reason for the problem is that moodle 1.99 uses an old version of tcpdf that does not do right-to-left languages.
Moodle 2.0 should not have this problem, since it has a newer version of tcpdf.
Hebrev only works on iso-8859-8, so the string needs to be converted from utf before flipping, and then converted back.
This tip comes from the comments in the php manual on the hebrev function.
Put it in lib.php in the function
// for example:
$s = $course->fullname;
$s = iconv("ISO-8859-8", "UTF-8", hebrev(iconv("UTF-8", "ISO-8859-8", $s)));
$newrec->classname = addslashes($s);