views:

47

answers:

1

Is there a way for me to lossless compress text with the following characters(88 in total)?

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789!@#$%&*()-_+=;:'"<,>.?/[]{}

I am making a chat but I don't want it to be wasting so much bandwidth(an old chat I used a few hours wasted 800mb).

The text would be compressed in javascript(when typed in to chat input box), sent to php(which saves them somewhere), then sent back when requested(ajax in chat) in the compressed format and decompressed with javascript.

+5  A: 

You don't need compression when sending to the chat server. That's not your bandwidth.

To save traffic when sending from the chat server, just enable GZip compression.

Gordon
+1 very true. plus for every message received by the server, it would be sent out a lot more times, each to every user in the chat so it makes more sense to compress the outbound message so GZip is the best bet.
Lukman
Ok, thanks. But wouldn't it be faster with compressed sending?
Neb
@Neb Well. Doing the (De-)Compression takes time too. So if you got a very slow computer with a fast upstream, it might take longer than just sending the data uncompressed. Then again, you might have a fast computer and only low upstream, then it might take longer to send - but that's completely hypothetical and given that chat messages are usually small, coming up with a javascript compression to send from client is rather pointless.
Gordon
@GordonI guess your right :-\ . If i was to make a string half it's size, I would have to have 7744 characters available to use.
Neb