The HebrewSecurImage Captcha generator

This post was written by eli on January 1, 2009
Posted Under: Internet

Introduction

Sample of Captcha image

Do you recognize the letters in the example image above? If you do, I suppose you’re a Hebrew speaker. And since the letters are shown in handwriting style, just a Hebrew keyboard is not enough, since the keys are marked with type-style letters. With basic Hebrew skills, the translation is obvious. Others will have to work harder.

This Captcha generator is intended to filter non-Hebrew speakers from Hebrew sites. Antisemitic forum spam is a well-known problem. While capthcas based upon digits solve the problem Israeli children face with English letters, a Hebrew letters captcha allow the Israelis in, and keep those who have nothing to do there anyway, out.

The software, which is released under LGPL (font under GPL) is a PHP script, which should run out of the box on any fairly updated web server.

Encoding issues (important!)

Your page must be encoded in either UTF-8, windows-1255 or ISO 8859-8. Otherwise, the user may enter the right code but will be denied access anyhow, because the browser messed up the Hebrew letters when submitting the form (and the code typed). It may work with other encodings, but it’s not recommended to gamble with this.

The good news are, that your page is most likely already encoded in one of these. The bad news are that you have to make sure that the browser doesn’t get confused.

Keep in mind, that unless the encoding is explicitly declared in HTML or by the HTTP headers, the browser will pick its own default, which depends on, well, everything. So if you don’t declare the encoding, the captcha will work for some and not for others, with no apparent explanation.

It’s common to declare the encoding with one of the following lines in the HTML code. Pick the one that doesn’t mess your page up. One of these lines should be between your <head> and </head> tags.

<meta http-equiv="content-type" content="text/html; charset=utf-8">

or:

<meta http-equiv="content-type" content="text/html; charset=windows-1255">

Hebrew issues

Hebrew has two special issues: It goes from right to left, and we have the special treatment of the last letter. To avoid problems, it’s recommended to tell users

  • to copy the letters from right to left (which the natural behavior)
  • not to alter the last letter (e.g. Mem to Mem-Sofit)

Download

The package, which you can download as a tarball or as a ZIP file is a slightly modified version of version 1.0.3 of the Securimage Captcha, which you can download here.

Please visit the the original site and read their documentation before attempting to install the Hebrew version. Both versions are virtually the same.

And if you have problems installing the Hebrew, please make sure that you manage to do it with the original version first.

The font used by default is “Ktav Yad” (which means “handwriting” in Hebrew) by Maxim Iorsh. Any TrueType font supporting hebrew will do, but you can download other free fonts at Culmus’ web site at SourceForge.

Add a Comment

required, use real name
required, will not be published
optional, your blog address