What type of encoding can I use to make a string shorter?

Posted by Abe Miessler on Programmers See other posts from Programmers or by Abe Miessler
Published on 2011-11-10T21:01:47Z Indexed on 2011/11/11 18:25 UTC
Read the original article Hit count: 317

Filed under:
|

I am interested in encoding a string I have and I am curious if there is a type of encoding that can be used that will only include alpha and numeric characters and would preferably shorten the number of characters needed to represent the string.

So far I have looked at using Base64 encoding to do this but it appears to make my string longer and sometimes includes == which I would like to avoid. Example:

test name|120101

becomes

dGVzdCBuYW1lfDEyMDEwMQ==

which goes from 16 to 24 characters and includes non-alphanumeric.

Does anyone know of a different type of encoding that I could use that will achieve my requirements? Bonus points if it's either built into the .NET framework or there exists a third party library that will do the encoding.

© Programmers or respective owner

Related posts about .NET

Related posts about text-encoding