Capital I(i) & Small l(L) — Visible Conflict discussion

Vasista Reddy
2 min readDec 28, 2018

--

Have you ever wondered why these two letters (capital ‘I’ and lowercase ‘L’) look the same in some fonts? — in mainly sans serif fonts.

few sans serif fonts

What if this set of (Capital ei & Small el) homoglyphs comes in real-time problems. Let's take the Captcha problem, if a human can’t distinguish the homoglyphs in some fonts, we can’t expect the robots to decode it.

Captcha image

In the above captcha image, the users can make possible errors at three places indexed at 0, 1, and 2 with Capital ei and Small el. Let's say the developer is fine validating the captcha with all the possibilities of errors users entering with Capital ei and Small el. Total number of possible strings we get if Capital ei and Small el present in the captcha is given by the formula

Which is same as the Cartesian Product of the homoglyphs set

Total possibilities of the above captcha users can enter are:

['llIinois', 'IlIinois', 'IIIinois', 'IIlinois', 'lIlinois', 'lllinois', 'lIIinois', 'Illinois']

Let’s implement this with python:

we can find the possibilities with itertools module python with the following code

n = 3 # three occurrences in the stringimport itertoolsdef finding_possibilities(n):
return list(set([''.join(comb) for comb in list(itertools.product('lI', repeat=n))]))
print('possibilities:',finding_possibilities(n))possibilities: ['Ill', 'IlI', 'lIl', 'llI', 'III', 'IIl', 'lII', 'lll']

Over the loop of possibilities, we can replace the original string and make the list of all possible strings users can enter. Here is the gist code.

possibities: ['IlI', 'Ill', 'lIl', 'III', 'lll', 'llI', 'lII', 'IIl']
values: ['I', 'l', 'l']
indexes: [0, 1, 2]
['lllinois', 'IlIinois', 'lIIinois', 'llIinois', 'IIlinois', 'lIlinois', 'IIIinois', 'Illinois']

Here are the more homoglyphs(0 and O; 1, l and I ). Have a good read about it.

Thanks for reading…….

If you like the concept, please don’t forget to endorse my skills on Linkedin.

--

--

Vasista Reddy
Vasista Reddy

Written by Vasista Reddy

Works at Cognizant. Ex-Turbolab-ian and loves trekking…. Reach_Me_Out_on_Linkedin: https://www.linkedin.com/in/vasista-reddy-100a852b/

No responses yet