Gregwar / Captcha

PHP Captcha library
MIT License
1.73k stars 290 forks source link

Uppercase and lowercase are treated as the same thing #65

Open AnnoyingTechnology opened 6 years ago

AnnoyingTechnology commented 6 years ago

When a picture generated uses uppercase letters, ->getPhrase() returns a lowercase phrase.

MaksNovalis commented 6 years ago

Had the same issue. The Problem is the font: "captcha2.ttf". I removed it (rearranged the random number) and the captcha doesn't show any uppercase letters again.

AnnoyingTechnology commented 6 years ago

@MaksNovalis Would you mind offering a pull request with your changes so that other can benefit from it ?

Cacodaimon commented 5 years ago

@Gregwar A fix for this would be nice!

Gregwar commented 5 years ago

Hello, Actually no uppercase letters are generated in first place, maybe the confusion is related to the fonts or the appearance of image

However, I suggest you to use case insensitive comparsions, and as well offer some tolerance for 0 vs O and 1 vs l

I added an helper PhraseBuilder::comparePhrases() to do that, and updated the example in demo/form.php

Cacodaimon commented 5 years ago

Hi @Gregwar,

Actually no uppercase letters are generated in first place, maybe the confusion is related to the fonts or the appearance of image

The font captcha2.ttf contains only upper case letters, this is the reason that some captchas gets displayed in upper case letters.

This is a screenshot of the captcha2.ttf where you can see that the lower case letters are upper case: Screenshot_2019-08-29_10-36-16

Just another font as comparison: Screenshot_2019-08-29_10-36-36

I added an helper PhraseBuilder::comparePhrases() to do that, and updated the example in demo/form.php

This helper is cool and I will use it, but we tell out user that all letters in the captcha are in lowercase therefore some captcha, displayed in upper case, lead to confusion.

Gregwar commented 5 years ago

Maybe we should replace that font as well so it would be more clear

gitator commented 3 years ago

Maybe we should replace that font as well so it would be more clear

yes, it's causing confusion when trying to hit correct phrase sometimes...