Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling visually ambiguous characters in Google URL-shortener output

Is there a way to say (programmatically, I mean their API) the Google URL shortener not to produce short URL with characters like:

0 O

1 l

Because people often make mistake when reading those characters from displays and typing them elsewhere.

like image 250
Jiri Kremser Avatar asked Nov 01 '22 22:11

Jiri Kremser


2 Answers

You cannot request the API to use a custom charset, so no.

Not a proper solution, but you could check the url for unwanted characters and request another short URL for the same long URL until you get one you like. Google URL shortner issues a unique short URL for an already shortned URL if you provide an OAuth token with the request. However I am not sure if a user is limited to one unique short URL per a specific long URL in which case this won't work either.

like image 167
MiJo Avatar answered Nov 09 '22 06:11

MiJo


Since you're doing it programmatically, you could swap out those chars for their ascii value, '%6F' for the letter o, for instance. In this case, just warn the users that in doubt, it's a numeral.

Alternatively, use a font that distinguishes ambiguous chars, or better yet, color-code them (or underline numerals, or whatever visual mark)

like image 41
Jay Avatar answered Nov 09 '22 08:11

Jay