[pmwiki-users] Text captcha notes

Petko Yotov 5ko at 5ko.fr
Tue Jul 15 23:07:09 CDT 2008


On Wednesday 16 July 2008 04:50:47 Marcus wrote:
> There is one thing which needs adding in text captchas -- comparison
> needs to be case-insensitive for some languages and case-sensitive for
> others (see below). I think most are case-insensitive so that should
> be default.
...
>
> $resp = strtolower($resp);
...
> on a website written in German, users would expect the respective
> response to the "which is larger, and elephant or an  ant?" challenge,
> to be "Elefant", not "elefant".

I believe if the German user writes the correct answer, but all-lowercase or 
all-uppercase, this should be considered successfull, and access should be 
granted; in any case, there are few chances that this would be filled by a 
robot.


> - For the PHP function "strtolower()" to work with languages with
> non-ASCII upper-case letters, e.g. A with umlaut in German, the locale
> needs to be set accordingly on the server.

You can use the PmWiki built-in function $StrFoldFunction which transforms the 
text to lowercase, both on the standard 8-bit latin-1 encoding and in 
unicode/utf-8:

 $resp = $StrFoldFunction($resp);

Thanks,
Petko




More information about the pmwiki-users mailing list