views:

27

answers:

1

I need to encode some data (text) so that it can easily be passed by the user over phone.
The text contains random characters and is normally not longer than 100 chars. Example:

"37-b,kA.sZ:Bb9--10.y<§"

I'd like to encode this text into more human readable form so that it can easily be passed over phone.
Base36 produces a text that can easily be passed over phone, but I don't see how to encode/decode this correctly.
Any ideas or alternatives?

(Platform is .net 3.5 SP1)

+1  A: 

Base 36 sounds like a good choice (when using symbols a-z and 0-9, it is the largest space of characters, that can be easily passed over the phone). I would suggest you make the output contain blocks of 6 or 8 characters, to make it easier to read. Also; consider adding a checksum in the end, so you can verify there are no errors in the data.

100 characters in this encoding will still not be easy to read over the phone and get right the first time. Have you considered another delivery mechanism ? Text message (SMS) ?

On Wikipedia, there is an example of encoding Base36 in Python - shouldn't be too hard to convert to C#.

driis
These examples are always converting numbers to Base36. I do however have to encode a string value (see example in question). Do you know about any guideline how this is done best or do I have to come up with my own solution? I could convert the string to a byte array and encode this one, but this has problems when decoding because not all characters have the same length in numerical representation.
Marc