How do I compress a string for sending via a GET request?
-
Hello!
I need to send in a get-request (through a parameter) a string of the form: 123_78900_44343_4349 _..._ 34343_121 (many numeric codes separated by underscores).
Can you please tell me, can I somehow compress (reduce) this string, but so that it can be restored on the server?JavaScript Anonymous, Jul 20, 2020 -
Convert codes to a different number system.
For example, taking 64-bit system [0-9a-zA-Z \ -_] from 78900 we getjgQ
.
If all numbers fall within a certain range, then you can try to abandon underscores and write each number with a fixed number of digits and leading zeros. Then, for example, 123_78900_44343_4349 is converted to01XjgQaQT13Z
Anonymous -
I need to send in a get-request (via a parameter) a string like this: 123_78900_44343_4349 _..._ 34343_121 (many numeric codes separated by underscores).
Don't do this. This is an erroneous decision that will breed problems.
Easy solution - use POST request.Rhys Odom -
zip + base64 (or maybe UUE will give more compression)
but after base64 it may turn out that the size gets even bigger.Anonymous
3 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!