When you say "characters" what do you mean? Bytes or unicode code points? Does "Αλφαβετ" count as seven characters or as 14? If we're truly talking about characters, and not just bytes, then defining some sort of base-65536 encoding would probably be feasible, and you might be able to pack 80 or so ASCII characters into a 19 character unicode string. Not an especially attractive solution.
Do you need to be able to reverse the encoding - i.e. expand the encoded string back to the URL? If not, then a digest function such as MD5 should be adequate. Digest::MD5's md5_base64 function is 22 characters. As you are only using it as an identifier, there should be no harm in simply stripping off the final three characters.
In reply to Re: Character Length Requirement & String Conversion
by tobyink
in thread Character Length Requirement & String Conversion
by bpthatsme
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |